View Full Version : different colors on either side of triangle

02-19-2000, 03:15 PM
I am trying to draw some (rotatable) surfaces (say, a blanket) in 3D and I want either side of the surface to have a different color. One logical limit of this is to draw a single triangle with a different color on either side. I can't do this.
I can use culling and get no back surface, and I can use glPolygonMode(GL_BACK, GL_LINES) and get wire-frame, but I cannot get a different color there.

I have tried glColorMaterial(GL_BACK, GL_AMBIENT_AND_DIFFUSE) glColor3f(1.0,0.0,0.0), and a variety of other methods. The back always comes out the same color as the front.

There is something here I don't understand. Help,


02-20-2000, 04:07 PM
use 2 different triangles, one offset very slightly from the other, so they appear to be different triangles. Then pick which color you want each triangle to be.

02-20-2000, 04:55 PM
Thanks for the reply. I can see that will work for the individual triangle, but when I draw a complex surface, composed of perhaps millions of such triangles, that solution seems impractical. Or at least it seems there ought to be a better way. Is there no way to use GL_BACK and GL_FRONT to solve this problem?

thanks again,

02-20-2000, 05:35 PM
I figured it out. In order to make the GL_BACK stuff work I need to enable two
sided lighting via

I guess I need to spend more time reading the reference manual.