Silicon Graphics

[Prev] [TOC] [Next]



(-) OpenGL Programming Guide
(-) Appendix CThe OpenGL Utility Library
(-) Polygon Tessellation

Describing the Polygon to Be Tessellated

The polygon to be tessellated, possibly containing holes, is specified using the following four routines: gluBeginPolygon(), gluTessVertex(), gluNextContour(), and gluEndPolygon(). For polygons without holes, the specification is exactly as in OpenGL: start with gluBeginPolygon(), call gluTessVertex() for each vertex in the boundary, and end the polygon with a call to gluEndPolygon(). If a polygon consists of multiple contours, including holes and holes within holes, the contours are specified one after the other, each preceded by gluNextContour(). When gluEndPolygon() is called, it signals the end of the final contour and starts the tessellation. You can omit the call to gluNextContour() before the first contour. The detailed descriptions of these functions follow. void gluBeginPolygon(GLUtriangulatorObj *tessobj);

Begins the specification of a polygon to be tessellated and associates a tessellation object, tessobj, with it. The callback functions to be used are those that were bound to the tessellation object using the routine gluTessCallback().

void gluTessVertex(GLUtriangulatorObj *tessobj,GLdouble v[3], void *data);

Specifies a vertex in the polygon to be tessellated. Call this routine for each vertex in the polygon to be tessellated. tessobj is the tessellation object to use, v contains the three-dimensional vertex coordinates, and data is an arbitrary pointer that's sent to the callback associated with GLU_VERTEX. Typically, it contains vertex data, texture coordinates, color information, or whatever else the application may find useful.

void gluNextContour(GLUtriangulatorObj *tessobj, GLenum type);

Marks the beginning of the next contour when multiple contours make up the boundary of the polygon to be tessellated. type can be GLU_EXTERIOR, GLU_INTERIOR, GLU_CCW, GLU_CW, or GLU_UNKNOWN. These serve only as hints to the tessellation. If you get them right, the tessellation might go faster. If you get them wrong, they're ignored, and the tesselation still works. For a polygon with holes, one contour is the exterior contour and the others interior. gluNextContour() can be called immediately after gluBeginPolygon(), but if it isn't, the first contour is assumed to be of type GLU_EXTERIOR. GLU_CW and GLU_CCW indicate clockwise- and counterclockwise- oriented polygons. Choosing which are clockwise and which are counterclockwise is arbitrary in three dimensions, but in any plane, there are two different orientations, and the GLU_CW and GLU_CCW types should be used consistently. Use GLU_UNKNOWN if you don't have a clue.

void gluEndPolygon(GLUtriangulatorObj *tessobj);

Indicates the end of the polygon specification and that the tessellation can begin using the tessellation object tessobj.


[Prev] [TOC] [Next]

OpenGL Programming Guide


Maintained by Maintainer: Send e-mail to .htm">name@address.