PDA

View Full Version : mixing glBindTexture and glColor3f



RobertSI
03-06-2001, 10:46 AM
I need some clarification here.
Example:
init()
{
glEnable(GL_TEXTURE_2D);

other stuff...
}

display()
{
glPushMatrix();

glTranslatef(...);

glBindTexture2D(....);
draw_box();

glBindTexture2D(....);
draw_box2();

glColor3f(1.0,0.0,0.0);
draw_box3();

glPopMatrix();

glutSwapBuffers();
}
How come draw_box3() isn't drawn red?
How come texturing is turned off and everything in scene is red?
Should I use glDeleteTexture(s) or glDisable(GL_TEXTURE_2D)?

DaViper
03-06-2001, 10:52 AM
yep to draw colored you need to call glDisable(GL_TEXTURE_2D)

Tim Stirling
03-07-2001, 10:04 AM
It is important to note that once you have called glColor then everything you render after that will be that colour. Just because you set the color to red at the end of your rendering function doesn't mean that only box3 will be red. The first time you run it the other boxes will be coloured with the defualt white, butafter that since red is the color still in the `state machine` all boxes will be red.

DaViper
03-08-2001, 12:22 AM
oops didn't notice the sentence about everything being drawn red. Yep Tim is right once a color is set to a specific color it will stay that way untill it is changed.