I am highlighting an object that uses a texture.
Initialize ()
{
…
glEnable(GL_DEPTH_TEST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}
//highlighting code
glLineWidth(6);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
DrawObject();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1);
DrawObject();
This code works fine except that the highlighting is very settle. Default line color is used.
I added three lines of code to fix the problem
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); (1)
glLineWidth(6);
glColor3f(1.0f,0.0f,0.0f); (2)
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
DrawObject();
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); (3)
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glLineWidth(1);
DrawObject();
It works as long as I stay on that scene. When I click the highlighted item, I enter a different scene and when I come back the highlighting part is dark (surrounding of my object is dark).
I can’t figure out what is wrong.
clogon