PDA

View Full Version : Missing some Initialization



clogon
05-24-2002, 11:49 AM
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

phil_24284
05-25-2002, 11:42 AM
Hi,
Have you tried to set
glDisable(GL_TEXTURE_2D) ? I think lines are
also affected by textures and so perhaps this could be the problem.
Phil

clogon
05-28-2002, 03:02 AM
Thanks Phil for your help. glDisable(GL_TEXTURE_2D) didnít change anything but then I started to disable different thing before drawing the line. It works when I disable glDisable(GL_LIGHTING) . I still donít know why.

Originally posted by phil_24284:
Hi,
Have you tried to set
glDisable(GL_TEXTURE_2D) ? I think lines are
also affected by textures and so perhaps this could be the problem.
Phil