View Full Version : Help - glBindTexture() disables texturing!

09-24-2001, 05:38 PM
Does anybody know why glBindTexture() can cause texturing to be disabled?
I'd specified my texture(proper pow of 2 dimensions without mipmaps) as usual with glTexImage2D() and called glTexParameteri() to set the minification filter option to 1 of the non-mipmapped ones.
Everything worked *fine* until I decided to bind the current texture to an ID(say 1) with glBindTexture()....texturing just got disabled!
I didn't get any error messages by way of glGetError()...so what gives?

Grateful for any pointer or help, anyone!

09-24-2001, 10:09 PM
maybe the part of code in which you generate and use the texture would be helpful...

09-25-2001, 09:54 PM
maybe the part of code in which you generate and use the texture would be helpful...

Right, here's the code snippet that does just that...

GLfloat tex[64*64*3]; //64x64 RGB texels
for(int pix=0;pix<(64*64);pix++)
} //set all texels to bright yellow
glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,64,64,0,GL_RGB ,GL_FLOAT,tex);
glBindTexture(GL_TEXTURE_2D,1); //if this is disabled, texturing works...else, texturing is disabled!

Any idea what's wrong? I haven't been able to figure out what could possibly be wrong...

09-25-2001, 10:07 PM
do u also have a MAG filter + WRAP_S + T set.
i know leaving some of those out will cause the image not to work

09-25-2001, 10:29 PM
You've got it backwards. You call glBindTexture first, then you make texture calls (like glTexImage2D or glTexParameter). These are all pre-processing steps.

When you are ready to use the texture, you just call glBindTexture with that particular texture identifier, and that texture, with all of its texture state that you set before, will become active.

What you've done here will essentially negate the calls to glTexImage2D and glTexParameter.

09-26-2001, 10:19 PM
Thanks Korval....I got it now!