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


C++ ITexture::UpdateTexture方法代码示例

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


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

示例1: OGLProceduralTexture

/**	Creates a Procedural based texture
 *
 *	@param	x				The width of the texture
 *	@param	y				The height of the texture
 *	@param	numcomp	The number of components in each pixel (3 = RGB, 4 = RGBA, etc)
 *	@param	proc		The procedure which will create the texture
 *
 *	@returns	An ITexture object or NULL if the texture failed to create
 *
 *	Operation:
 *		-#	Test how many textures exist, if zero, enable GL_TEXTURE_COORD_ARRAY
 *		-#	Create a new Procedural texture
 *		-#	Update the texture (this will load the image contents into the opengl texture object)
 *		-#	Store the texture pointer
 *		-#	Return the texture pointer
 */
ITexture * OGLGraphics::CreateTexture(int x, int y, int numcomp, ITexture::textureproc_t proc)
{
	if(Textures.size() == 0)	glEnableClientState(GL_TEXTURE_COORD_ARRAY);

	ITexture *texture = new OGLProceduralTexture(x,y,numcomp,proc);
	if(texture->UpdateTexture() >= 0){
		Textures.push_back(texture);
	}else{
		delete texture;
		texture = NULL;
	}

	return texture;
}
开发者ID:christhomas,项目名称:fusionengine,代码行数:30,代码来源:OGLGraphics.cpp

示例2: OGLImageTexture

/**	Creates an Image based Texture
 *
 *	@param image	The filename containing the image to use as a texture
 *
 *	@returns An ITexture object or NULL if texture failed to create
 *
 *	Operation:
 *		-#	If the number of textures is zero, enable GL_TEXTURE_COORD_ARRAY
 *		-#	Loop through the current existing textures and attempt to find
 *				a copy of the texture you are attempting to load
 *		-#	If a copy is found, return an ITexture pointer to that texture
 *		-#	If the texture is not found, Create a new ImageTexture object
 *		-#	Update the texture (this will load the image contents into the opengl texture object)
 *		-#	Store the texture pointer
 *		-#	Return the texture pointer
 */
ITexture * OGLGraphics::CreateTexture(std::string image)
{
	ITexture *texture = NULL;
	
	for(unsigned int a=0;a<Textures.size();a++){
		std::string test = Textures[a]->m_filename;

		if(image == test)	texture = Textures[a];
	}
	
	if(texture == NULL){
		texture	= new OGLImageTexture(image);

		if(texture->UpdateTexture() >= 0){
			Textures.push_back(texture);
		}else{
			delete texture;
			texture = NULL;
		}
	}

	return texture;
}
开发者ID:christhomas,项目名称:fusionengine,代码行数:39,代码来源:OGLGraphics.cpp


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