glDeleteTextures does not remove picture from memory
Members - Reputation: 130
Posted 09 May 2012 - 06:02 AM
I've run into an irritating problem.
After I load a picture with GLKTextureLoader, I can not free it from memory.
When I call glDeleteTextures(1,&texturename), nothing happens.
I use OpenglES2.0 on iOS5.1
Thanks in advance!
Moderators - Reputation: 6420
Posted 09 May 2012 - 07:17 AM
The only way to determine if the texture is valid is to query the object handle with glIsTexture. But this does not reflect any internal resources which may be what Instruments is reporting.
Members - Reputation: 306
Posted 09 May 2012 - 03:07 PM
I assume that you are probably deleting textures in dealloc method...
You should check if you still have working context (this is very important because otherwise you don't have working connection ) and delete textures before releasing context
"OpenGL functions do not work unless an OpenGL context has been created and is active within that thread. Thus, glGenTextures will do nothing before context creation, and glDeleteTextures will do nothing after context destruction."
for more info you should check http://www.opengl.org/wiki/Common_Mistakes part the object oriented Language problem
Crossbones+ - Reputation: 5574
Posted 09 May 2012 - 05:19 PM
Don't expect a glDeleteTextures call to behave like free () or delete in C/C++.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
Members - Reputation: 229
Posted 10 May 2012 - 01:41 AM
And then try to load a new texture with same size, probably you will notice no memory usage increase.
<a class="popularitybtn" href="http://www.indiedb.com/groups/gpi-gameprogit" title="View GPI - gameprog.it on Indie DB"><img src="http://button.indiedb.com/popularity/medium/groups/10573.png" alt="GPI - gameprog.it"></a>