system
February 14, 2005, 9:18pm
1
Hi!
I’ve created two textures, which overwrite themselves every two seconds.
Now I have to delete the textures every loop to clear the memory:
UINT TextureArray1[1];
UINT TextureArray2[1];
…
JPEG_Texture(TextureArray1, “data/texture/Bild1.jpg”, 0);
JPEG_Texture(TextureArray2, “data/texture/Bild2.jpg”, 0);
…
glDeleteTextures(1, TextureArray1);
glDeleteTextures(1, TextureArray2);
But it didnt’t work with these lines.
Can anyone tell me my failure?
Thx, Dave
Silkut
February 16, 2005, 7:02am
2
Are these lines between glBegin and GlEnd ?
check the MSDN out
glDeleteTextures @ the MSDN
system
February 17, 2005, 7:48am
3
Declare globally:
static GLuint TexID ;
My Texture Function
{
Try something like the following at the top of your texture function:
// Create array for texture with width, height and rgb component without alpha channel
GLubyte texture[512][512][3] ;
// Generate a texture index, then bind it
// Declare TexID globally or pass it as an argument to this function
glGenTextures(1,&TexID);
glBindTexture(GL_TEXTURE_2D,TexID);
.......your :
glTexEnvf
…your :
glTexParameterf 's
finally, build your MipMap :
gluBuild2DMipmaps( blah, blah, blah ans so on…,(void *)texture );
return TRUE;
}
Then on the way out delete like so:
glDeleteTextures( 1, &TexID );