PDA

View Full Version : Bug with glDeleteTextures on bound textures



poppyto
09-06-2013, 01:33 AM
Hello everybody,

I think I found a strange behavior with OGL 1.0 & OGL ES 1.1 :

if a texture is bound and you delete it and create a texture just after, the new old texture number is used (normal) but the texture is flagged as invalid !

The solution is to bind on 0 manually after glDeleteTextures (glBindTexture(GL_TEXTURE_2D,0);).
BUT the documentation says "If a texture that is currently bound is deleted, the binding reverts to 0 (the default texture)."

It's the same (wrong) behavior for me on Windows/Android/iOS.
You can test it with these few lines at home. Is it a bug or a wrong documentation ?

Stephane


GLuint tex;
glGenTextures(1,&tex);
glBindTexture(GL_TEXTURE_2D,tex);
GLboolean vIsTexture = glIsTexture(tex); // returns TRUE
glDeleteTextures(1,&tex);
glGenTextures(1,&tex);
glBindTexture(GL_TEXTURE_2D,tex);
vIsTexture = glIsTexture(tex); // returns FALSE, it should not !
glDeleteTextures(1,&tex);