One polygon, different color per face side...

Started by
1 comment, last by SAE Superman 17 years, 6 months ago
I've never had this situation come up until now... I have a polygon that I want to have the front face be one color and the back face be a different color. Is there an easy way to do this in OpenGL? Thanks in advance...
Advertisement
Disable backface culling glDisable(GL_CULL_FACE), then enable two-sided lighting glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, 1). Once that's done, you can specific separate materials for the front and back face of a polygon.

Alternatively you can just render two polygons with opposite vertex winding (thus a front and a back face), in different colors, and let backface culling remove the one that shouldn't be visible.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Thanks for the info...I'll probably go with the two polygon approach...

This topic is closed to new replies.

Advertisement