glActiveTexture bug?

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

You need to enable and disable each active texture.

Your sample code enables texture 0 then disables texture 1.

It also never enables texture 1 which will cause an additional problem, however in multi-frame rendering the active texture will be inherited from the previous frame, so the first frame only it won’t enable unit 1 then it will enable & disable unit 1, unit 0 will be permanently enabled after the first frame.

Solution: make multiple calls to enable & disable as you set the active texture to target those calls to the multi-texture units.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.