PDA

View Full Version : Free texture data but retain ID



NeXEkho
02-03-2011, 04:22 PM
I want to be able to free the texture data associated with a texture ID that was allocated via glGenTextures() but keep the ID reserved - is there a way to do this? Looking over the documentation, it seems odd to separate name creation and allocating texture space but not to separate name destruction and freeing of texture space.

ZbuffeR
02-03-2011, 04:29 PM
glTexImage2D(...,NULL); ?

Alfonse Reinheart
02-03-2011, 04:34 PM
I want to be able to free the texture data associated with a texture ID that was allocated via glGenTextures() but keep the ID reserved - is there a way to do this?

Not really. You could use glTexImage2D to allocate a really, really small image. But that's about it.

However, there's really no need to do something like this. The heaviest operation with texture creation is the allocation of the storage for it. Keeping the name around saves you nothing compared to the time it would take to recreate the image data.


glTexImage2D(...,NULL); ?

That won't do it. That'll just allocate some space with undefined data.

NeXEkho
02-03-2011, 04:52 PM
Right, thanks.