Front and Back sides with different colors

Is there a way of setting different drawing colors for the front and back sides of entities such as polygons and NURBS surfaces?



I know there is if you have lighting turned on. When you use glMaterial*(), the first parameter can be GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK. If you are not using GL lighting(just glColor*()), then I am not sure. You could also render your polygon mesh twice, the second time negating the normals(so that their fronts are facing the other direction), and just give the second mesh a different color than the first. Unfortunately I don’t know anything about OGL and NURBS, so I can’t help you there



Try this:

glEnable(GL_CULL_FACE) //Enable culling
glColor() //Set Front colour
DrawNURB() //Draw NURB
glFrontFace(GL_CW) //Set to draw back face
glColor() //Set Back colour
DrawNURB() //Draw NURB again
glFrontFace(GL_CCW) //Set to draw front face

Good luck with it