Thursday, 5 September 2013

Broken texture number OpenGL, after glGenTextures/glBindTexture

Broken texture number OpenGL, after glGenTextures/glBindTexture

I have a terrible behavior with one of my textures on OpenGL.
After deleting a texture, I create a new one, it generates the same tex
number as before, but the texture is incorrect. Also glGetError returns
always 0 on every line ! I tried to add glFlush/glFinish after
glDeleteTextures but it doesn't change anything ! the texture number seems
locked somewhere...why ?
It's single threaded, here the behavior :
//myTexture == 24 is loaded and works correctly
GLboolean bIsTexture = glIsTexture(myTexture); //returns 1 = > ok
CGL::glDeleteTextures(1,&myTexture);
bIsTexture = glIsTexture(myTexture); //returns 0 => ok
//Let's create a new texture
glGenTextures(1,&myTexture);//myTexture == 24 (as the glDelete was ok)
glBindTexture(GL_TEXTURE_2D,myTexture);
bIsTexture = glIsTexture(myTexture); //returns 0 => FAILS

No comments:

Post a Comment