Color mixed with texture

My previous colors are mysteriously being mixed together with my texture. I first use glColor4f to produce a green and red (alpha) colors for some quads. Then i make a quad that holds just my texture. And from this, somehow the green from drawing previous quads has leaked onto the texture ?

I found two option, none of which work:


This successfully removes the leaked colors onto the textures, but now the textures fails to work with basic OGL lighting.

Using no glTexEnvi (Which is what OpenGL FAQ suggested i do in this situation)
This leaks the previous colors onto the texture, but now successfully works with basic OGL lighting.

It sounds like you need glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE)
and set all the glMaterial parameters to white.

Modulate produced the same results as REPLACE.

Setting glColor to white actually solves the problem :slight_smile:

However, i’d like to know what the pipeline is the final color of each fragment in OpenGL.

Is it->

Final color = glColor*texture*lighting;

If so, is that why multiplying the glColor white (all 1’s) has no effect on final color?

If you had to use glColor instead of glMaterial, then you had enable material color tracking.
Yes, when your glTexEnv mode is MODULATE, then the final color is glColortexturelighting.

I’v been using glColor always and instead of glMaterial, i dont know if thats a bad thing, but i haven’t had any problems.
Normally i dont set any texture environment. Is MODULATE the same having the texture environment at default?

I’m not saying that enabling color tracking is bad. I’m just saying that you had not indicated in your post so I said use glMaterial.
Yes, the default is MODULATE.
Overall, all this is ancient history and eventually, you should move to GL 3.3 or 4.0.