PDA

View Full Version : lighting in tesselated polygons



kazmalak
11-15-2005, 07:42 AM
I have drawn a concave polygon using tesselation functions. When I draw the object CCW (as expected) and give the polygon normal as (0,0,1), it makes the lighting calculations correct.
However, I want to light the other side of the polygon. For this reason, I changed the order of vertices (to make the polygon in CCW order whwn looking at other side) and changed the normal as (0,0,-1). However, the lighting is not correctly done for the otherside of the polygon, and it becomes black. The code is below, can anyone describe me where I am doing wrong?


gluTessBeginPolygon(tobj, NULL);
gluTessProperty(tobj,GLU_TESS_WINDING_RULE,GLU_TES S_WINDING_POSITIVE);
gluTessNormal(tobj,0,0,-1);
gluTessBeginContour(tobj);
gluTessVertex(tobj, dummy1[0], dummy1[0]);
gluTessVertex(tobj, dummy1[3], dummy1[3]);
gluTessVertex(tobj, dummy1[2], dummy1[2]);
gluTessVertex(tobj, dummy1[1], dummy1[1]);
gluTessEndContour(tobj);
gluTessEndPolygon(tobj);

Aeluned
11-15-2005, 09:56 AM
The glLightModel call may help you out:
clicky (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/opengl/glfunc03_3y5o.asp)

You can just enable two sided lighting.