-
How to display two different colors on two sides of a triangle?
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!
-
Senior Member
OpenGL Guru
Re: How to display two different colors on two sides of a triangle?
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules