View Full Version : glActiveTexture bug?

07-13-2007, 08:34 AM
Hi, I'm not sure if this is a bug or how OpenGL is supposed to work, but here it goes:

I use glActiveTexture(GL_TEXTURE0) for my Shader for one part of my image. However when I disable the program and glDisable(GL_TEXTURE_2D), the color of my bitmap fonts and my other calls are being taken from the previous active texture even though I've disable GL_TEXTURE_2D. I've set the color before drawing and for the bitmap font, I do set the color before calling glRasterPos. I've verified these colors are stored properly by calling glGet for both GL_CURRENT_COLOR GL_RASTER_COLOR. The only way it works properly is if I do the following after I'm done with the texture units:

glBindTexture(GL_TEXTURE_2D, 0);

I don't want to send a bug report in unless I'm sure it's a bug. I'm using GLEW for my GLSL and my card has support for OpenGL 2.0 (which GLEW has shown to be true).

Here's some pseudo code to show what I'm doing:


glBindTexture(GL_TEXTURE_2D, myFirstTexture);
glBindTexture(GL_TEXTURE_2D, mySecondTexture);

....Draw some stuff....


glColor3f(1.0, 1.0, 1.0);

...Draw Some more stuff...

If anyone knows if this is a bug, let me know

07-13-2007, 08:46 AM
First, shaders don't need to enable texture units (of the fixed function pipeline!) at all because they use texture image units implied by the sampler ids you specified, nothing more.
Second, if that code is all you have, you forgot to disable the texturing for the active texture unit 0.
You need to enable and disable per texture unit and per texture target, in case you use other targets than GL_TEXTURE_2D elsewhere. But if you only want to use textures for the shaders, just remove the enable and disable calls alltogether.

07-13-2007, 07:51 PM
Yup, please don't repost your question. I replied to this elsewhere when it had already been responded to.