PDA

View Full Version : gluTessNormal



kazmalak
11-14-2005, 04:46 AM
I have drawn a concave polygon, using the code below


gluTessBeginPolygon(tobj, NULL);
gluTessNormal(tobj,0,0,1);
gluTessBeginContour(tobj);
gluTessVertex(tobj, rect[0], rect[0]);
gluTessVertex(tobj, rect[1], rect[1]);
gluTessVertex(tobj, rect[2], rect[2]);
gluTessVertex(tobj, rect[3], rect[3]);
gluTessVertex(tobj, rect[4], rect[4]);
gluTessEndContour(tobj);
gluTessEndPolygon(tobj);
As can be seen from the code, I have also defined the normal.
My first question is "When I have not included the gluTessNormal function, the lighting is still correctly performed. Then what is the benefit (or aim) of defining normal?"
Second one:"When I have defined the normal as given in the sample code, does this normal only affect the first vertex or does it become the surface normal of polygon (in other words affect all the vertices forming the polygon)?

Thanks in advance.

dorbie
11-14-2005, 04:02 PM
The answer to your second question is it depends on glShadeModel() (and having a normal that varies from vertex to vertex), although lighting results and vertex colors that differ per vertex also produce variations accross a polygon with the same normal if you have a GL_SMOOTH shademodel, not so with GL_FLAT.

The answer to the second question I think depends on the above.