PDA

View Full Version : How to display two different colors on two sides of a triangle?



loginlog
03-23-2003, 10:35 PM
I have tried to do as this:

glColor3f(1.0f,0.0f,0.0f);
glNormal3f(a,b,c);
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);

glColor3f(0.0f,1.0f,0.0f);
glNormal3f(-a,-b,-c);
glVertex3f(...);
glVertex3f(...);
glVertex3f(...);

but it doesn't work!who can help me!

Bob
03-23-2003, 10:37 PM
Enable backface culling and draw the triangle two times, one with vertices in clockwise order and one with vertices in counter clockwise order. OpenGL's backface culling is based on the order of the triangle's vertices in screen space, not the normal.