Free texture data but retain ID

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.

glTexImage2D(…,NULL); ?

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.

Right, thanks.