PDA

View Full Version : glDeleteTextures



02-14-2005, 10:18 PM
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
02-16-2005, 08:02 AM
Are these lines between glBegin and GlEnd ?
check the MSDN out
glDeleteTextures @ the MSDN (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc01_6vqr.asp)

02-17-2005, 08:48 AM
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 );