Memory Loss !!

I have a very annoying problem.

I am generating a texture with:
glGenTextures(1,&texture[0]);

and then creating mipmaps using
gluBuild2DMipmaps();

The problem is that every time i call the function to perform this, the program gets slower and slower and uses up more and more RAM until the computer eventually dies. I have tried glDeleteTextures(1,&texture[0]) to free the memory storing the texture but this doesnt seem to work either.

Could someone please tell me how i can free this memory.

Thanks,
Steve

Are you calling glGenTextures at each frame ? If you are you should only do it once to create your texture object and then only use glBindTexture. Sorry if I’m saying something you already know .

[This message has been edited by Olive (edited 04-12-2001).]

Is the rendering context current when you call glDeleteTextures?

Steven,

I’m assuming that you are using gluBuild2DMipmaps in a fashion similar to this:

gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB8, texture.width, texture.height, GL_RGB, GL_UNSIGNED_BYTE, texture.imageData);

…where texture.imageData is a pointer to the actual image data itself. Make sure that after you are done building the mip levels with the above texture function that you are calling free(texture.imageData) or delete depending on the convention you are using to load the texture file into memory.

Not freeing this memory will lead to a memory leak that could be the root cause of your problem.

My 2 cents…

Glossifah