View Full Version : [Q] When I call glDeleteTexture function..
07-21-2002, 07:11 AM
I put texture image data in heap memory..
If I call glDeleteTexture function, is that memory cleared and released automatically ??
if not, I think there'll be some memory leakage..
07-21-2002, 07:28 AM
When you bind your texture, OpenGL will place a *copy* of that texture into an appropriate place (either system memory or texture memory). In theory you can allocate heap, load your texture, bind your texture and then release the heap memory and still use that texture via. its bind Id.
In other words, you are responsible for deleting memory YOU have allocated. OpenGL will deal with the memory it allocates (behind the scenes) when you bind your texture.
Hope this helps.
07-21-2002, 08:12 AM
First of all , thanks for your help .
So, even though I deleted the memory on the heap allocated to my texture data after loading texture data, there exists some momory block containing RGB data somewhere and still, I can use that data via ID.
Here, I have a question..
If I don't call glDeleteTexture function when my program is about end, is there any memory leakage ?? or.... is it automatically released ??
07-21-2002, 09:57 AM
Yes, thats basically correct. Once you have bound the texture, GL will take over management *of its copy*, you are then free to release the memory you used to load it.
When you call glDelete*, the driver will free its copy internally. Its best practice to delete textures yourself using glDelete* and most if not all drivers will release the texture memory assigned to your textures internally when you delete the gl render context.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.