Hi. I’m trying to colorize one texture, and all other textures become colorized too
//This fuction binding all textures
void bindingFunction()
{
for(...)
{
glBindTexture(GL_TEXTURE_2D, tex[i]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(...);
// ... draw current texture & compile it in display list
// ...
} // for(...)
// Bind texture, that should be colorized
glBindTexture(GL_TEXTURE_2D, mark);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
glTexImage2D(...);
}
// repaint function
void repaint()
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
// call display lists
// ...
// draw standalonw texure
glBindTexture(GL_TEXTURE_2D, mark);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glBegin(GL_QUADS);
glColor3f(1.0, 0.0, 0.0);
glTexCoord2f(0.0, 0.0); glVertex2f(coords[0], coords[1]);
glTexCoord2f(1.0, 0.0); glVertex2f(coords[2], coords[3]);
glTexCoord2f(1.0, 1.0); glVertex2f(coords[4], coords[5]);
glTexCoord2f(0.0, 1.0); glVertex2f(coords[6], coords[7]);
glEnd();
}
So, texture name ‘mark’ looks OK, but the alpha channel in other textures becomes red! Non-transparent textures in display list are drawn OK.
What’s wrong ?
Thanks.