Open GL Super Bible

Previous Table of Contents Next


Summary

The OpenGL polygon tessellator can be used to render a variety of complex polygons that OpenGLís GL_POLYGON primitive just canít handle. Polygon tessellation does come at a price, and you will want to put these tessellated polygons into display lists to get good performance from them.

The callback mechanism allows for some control over the generated results but does not affect the tessellation algorithms used. Callback functions are rarely used because of this.

Reference Section

gluBeginPolygon

Purpose
Starts tessellation of a complex polygon.
Include File
<GL/glu.h>
Syntax
void gluBeginPolygon(GLUtriangulator *tobj);
Description
This function starts tessellation of a complex polygon.

Parameters

tobj
GLUtriangulatorObj *: The tessellator object to use for the polygon.
Returns
None.
Example
See the example in CH18\LETTER.C on the CD.
See Also
gluEndPolygon, gluNextContour, gluTessVertex

gluDeleteTess

Purpose
Deletes a tessellator object.
Include File
<GL/glu.h>
Syntax
void gluDeleteTess(GLUtriangulatorObj *tobj);
Description
The gluDeleteTess function frees all memory associated with a tessellator object.

Parameters

tobj
GLUtriangulatorObj *: The tessellator object to delete.
Returns
None.
Example
See the example in CH18\LETTER.C on the CD.
See Also
gluNewTess

gluEndPolygon

Purpose
Ends tessellation of a complex polygon and renders it.
Include File
<GL/glu.h>
Syntax
void gluEndPolygon(GLUtriangulator *tobj);
Description
This function ends tessellation of a complex polygon and renders the final result.

Parameters

tobj
GLUtriangulatorObj *: The tessellator object to use for the polygon.
Returns
None.
Example
See the example in CH18\LETTER.C on the CD.
See Also
gluBeginPolygon, gluNextContour, gluTessVertex

gluNewTess

Purpose
Creates a tessellator object.
Include File
<GL/glu.h>
Syntax
GLUtriangulatorObj *gluNewTess(void);
Description
The gluNewTess function creates a tessellator object.
Parameters
None.
Returns
GLUtriangulatorObj *: The new tessellator object.
Example
See the example in CH18\LETTER.C on the CD.
See Also
gluDeleteTess

gluNextContour

Purpose
Specifies a new contour or hole in a complex polygon.
Include File
<GL/glu.h>
Syntax
void gluNextContour(GLUtriangulator *tobj, GLenum type);
Description
This function specifies a new contour or hole in a complex polygon.

Parameters

tobj
GLUtriangulatorObj *: The tessellator object to use for the polygon.
type
GLenum: The type of contour. Valid types are in Table 18-1 earlier in chapter.
Returns
None.
Example
See the example in CH18\LETTER.C on the CD.
See Also
gluBeginPolygon, gluEndPolygon, gluTessVertex

gluTessCallback

Purpose
To specify a callback function for tessellation.
Include File
<GL/glu.h>
Syntax
void gluTessCallback(GLUtriangulator *tobj, GLenum which, void (*fn)());
Description
This function specifies a callback function for various tesselation functions. Callback functions do not replace or change the tessellator performance. Rather, they provide the means to add information to the tessellated output (such as color or texture coordinates).

Parameters

tobj
GLUtriangulatorObj *: The tessellator object to use for the polygon.
which
GLenum: The callback function to define. Valid functions are in Table 18-2 earlier in chapter.
fn
void (*)(): The function to call.
Returns
None.

gluTessVertex

Purpose
Adds a vertex to the current polygon path.
Include File
<GL/glu.h>
Syntax
void gluTessVertex(GLUtriangulator *tobj, GLdouble v[3], void *data);
Description
This function adds a vertex to the current tessellator path. The data argument is passed through to the GL_VERTEX callback function..

Parameters

tobj
GLUtriangulatorObj *: The tessellator object to use for the polygon.
v
GLdouble[3]: The 3D vertex.
data
void *: A data pointer to be passed to the GL_VERTEX callback function.
Returns
None.
Example
See the example in CH18\LETTER.C on the CD.
See Also
gluBeginPolygon, gluEndPolygon, gluNextContour


Previous Table of Contents Next