PDA

View Full Version : Front and Back sides with different colors



calbuq
04-17-2000, 03:22 PM
Hi
Is there a way of setting different drawing colors for the front and back sides of entities such as polygons and NURBS surfaces?

Thanx

CB

drumminj
04-19-2000, 05:17 AM
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

hth.

J

FATBUDDHA
04-20-2000, 03:23 AM
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