当前位置: 首页>>代码示例>>C++>>正文


C++ GLTexture::dispose方法代码示例

本文整理汇总了C++中GLTexture::dispose方法的典型用法代码示例。如果您正苦于以下问题:C++ GLTexture::dispose方法的具体用法?C++ GLTexture::dispose怎么用?C++ GLTexture::dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GLTexture的用法示例。


在下文中一共展示了GLTexture::dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: testSerialization

static void testSerialization() {
	GLTexture texture;
	TestSerializationContext * context;
	jmp_buf jmpEnv;
	
	context = TestSerializationContext_create(&jmpEnv);
	if (setjmp(jmpEnv) != 0) {
		TestCase_assert(false, "%s", context->error);
	}
	
	GLTexture_init(&texture, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, GL_LINEAR, GL_REPEAT, GL_CLAMP_TO_EDGE, AUTO_BLEND_MODE_NONE, false, false);
	texture.imageName = "foo";
	
	context->expectCall(context, context->beginStructure, "gltexture");
	context->expectCall(context, context->writeUInt16, "format_version", GLTEXTURE_SERIALIZATION_FORMAT_VERSION);
	context->expectCall(context, context->writeString, "image_name", "foo");
	context->expectCall(context, context->writeEnumeration, "bitmap_data_format", GL_RGBA, enumKV(GL_ALPHA), enumKV(GL_LUMINANCE), enumKV(GL_LUMINANCE_ALPHA), enumKV(GL_RGB), enumKV(GL_RGBA), NULL);
	context->expectCall(context, context->writeEnumeration, "bitmap_data_type", GL_UNSIGNED_BYTE, enumKV(GL_UNSIGNED_BYTE), enumKV(GL_UNSIGNED_SHORT_5_6_5), enumKV(GL_UNSIGNED_SHORT_4_4_4_4), enumKV(GL_UNSIGNED_SHORT_5_5_5_1), NULL);
	context->expectCall(context, context->writeEnumeration, "min_filter", GL_NEAREST, enumKV(GL_NEAREST), enumKV(GL_LINEAR), enumKV(GL_NEAREST_MIPMAP_NEAREST), enumKV(GL_LINEAR_MIPMAP_NEAREST), enumKV(GL_NEAREST_MIPMAP_LINEAR), enumKV(GL_LINEAR_MIPMAP_LINEAR), NULL);
	context->expectCall(context, context->writeEnumeration, "mag_filter", GL_LINEAR, enumKV(GL_NEAREST), enumKV(GL_LINEAR), NULL);
	context->expectCall(context, context->writeEnumeration, "wrap_s", GL_REPEAT, enumKV(GL_CLAMP_TO_EDGE), enumKV(GL_REPEAT), NULL);
	context->expectCall(context, context->writeEnumeration, "wrap_t", GL_CLAMP_TO_EDGE, enumKV(GL_CLAMP_TO_EDGE), enumKV(GL_REPEAT), NULL);
	context->expectCall(context, context->writeEnumeration, "auto_blend_mode", AUTO_BLEND_MODE_NONE, enumKV(AUTO_BLEND_MODE_NONE), enumKV(AUTO_BLEND_MODE_OPAQUE), enumKV(AUTO_BLEND_MODE_TRANSPARENT_NONPREMULTIPLIED), enumKV(AUTO_BLEND_MODE_TRANSPARENT_PREMULTIPLIED), NULL);
	context->expectCall(context, context->writeBoolean, "auto_mipmap", false);
	context->expectCall(context, context->writeBoolean, "anisotropic_filter", false);
	context->expectCall(context, context->endStructure);
	
	GLTexture_serialize(&texture, (SerializationContext *) context);
	
	context->finish(context);
	context->dispose(context);
	texture.dispose(&texture);
	
	context = TestSerializationContext_create(&jmpEnv);
	if (setjmp(jmpEnv) != 0) {
		TestCase_assert(false, "%s", context->error);
	}
	
	GLTexture_init(&texture, GL_RGB, GL_UNSIGNED_SHORT_4_4_4_4, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST, GL_CLAMP_TO_EDGE, GL_REPEAT, AUTO_BLEND_MODE_TRANSPARENT_NONPREMULTIPLIED, true, true);
	texture.imageName = "bar";
	
	context->expectCall(context, context->beginStructure, "gltexture");
	context->expectCall(context, context->writeUInt16, "format_version", GLTEXTURE_SERIALIZATION_FORMAT_VERSION);
	context->expectCall(context, context->writeString, "image_name", "bar");
	context->expectCall(context, context->writeEnumeration, "bitmap_data_format", GL_RGB, enumKV(GL_ALPHA), enumKV(GL_LUMINANCE), enumKV(GL_LUMINANCE_ALPHA), enumKV(GL_RGB), enumKV(GL_RGBA), NULL);
	context->expectCall(context, context->writeEnumeration, "bitmap_data_type", GL_UNSIGNED_SHORT_4_4_4_4, enumKV(GL_UNSIGNED_BYTE), enumKV(GL_UNSIGNED_SHORT_5_6_5), enumKV(GL_UNSIGNED_SHORT_4_4_4_4), enumKV(GL_UNSIGNED_SHORT_5_5_5_1), NULL);
	context->expectCall(context, context->writeEnumeration, "min_filter", GL_NEAREST_MIPMAP_NEAREST, enumKV(GL_NEAREST), enumKV(GL_LINEAR), enumKV(GL_NEAREST_MIPMAP_NEAREST), enumKV(GL_LINEAR_MIPMAP_NEAREST), enumKV(GL_NEAREST_MIPMAP_LINEAR), enumKV(GL_LINEAR_MIPMAP_LINEAR), NULL);
	context->expectCall(context, context->writeEnumeration, "mag_filter", GL_NEAREST, enumKV(GL_NEAREST), enumKV(GL_LINEAR), NULL);
	context->expectCall(context, context->writeEnumeration, "wrap_s", GL_CLAMP_TO_EDGE, enumKV(GL_CLAMP_TO_EDGE), enumKV(GL_REPEAT), NULL);
	context->expectCall(context, context->writeEnumeration, "wrap_t", GL_REPEAT, enumKV(GL_CLAMP_TO_EDGE), enumKV(GL_REPEAT), NULL);
	context->expectCall(context, context->writeEnumeration, "auto_blend_mode", AUTO_BLEND_MODE_TRANSPARENT_NONPREMULTIPLIED, enumKV(AUTO_BLEND_MODE_NONE), enumKV(AUTO_BLEND_MODE_OPAQUE), enumKV(AUTO_BLEND_MODE_TRANSPARENT_NONPREMULTIPLIED), enumKV(AUTO_BLEND_MODE_TRANSPARENT_PREMULTIPLIED), NULL);
	context->expectCall(context, context->writeBoolean, "auto_mipmap", true);
	context->expectCall(context, context->writeBoolean, "anisotropic_filter", true);
	context->expectCall(context, context->endStructure);
	
	GLTexture_serialize(&texture, (SerializationContext *) context);
	
	context->finish(context);
	context->dispose(context);
	texture.dispose(&texture);
}
开发者ID:svn2github,项目名称:libstem,代码行数:61,代码来源:GLTextureTest.c


注:本文中的GLTexture::dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。