View Full Version : How can I clear used textures from the memory??
11-15-2005, 04:26 AM
I am using OpenGL to display 128*128 Bitmaps in a 3D space. Everytime I load a new Bitmap and create a texture. So the memory allocated for the programme keeps increasing until there is not enough memory and the programme stops running. Who knows how to clear used textures in the memory because I need each of them only once. Thanks
Are you loading the image over and over again every time you display it? If so, why not load it once and reuse the texture?
Anyway, to answer the question asked: textures are deleted with glDeleteTexture.
11-15-2005, 04:42 AM
The texture I use is different every time. So I have to load a new one every time.
I will try your method.
In that case, you may want to look at glTexSubImage. You can use it to update a texture with new data. Calling glTexImage for each new texture will completely reallocate the texture, while glTexSubImage will just upload new data. It can be much more efficient, but it pretty much assumes all textures are of the same size.
11-15-2005, 03:10 PM
Thank you very much. Both methods work well.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.