本文整理汇总了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;
}
示例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;
}