gluTessBeginPolygon, gluTessEndPolygon

The gluTessBeginPolygon and gluTessEndPolygon functions delimit a polygon description.

void gluTessBeginPolygon(
  GLUtesselator * tess,   
  void * polygon_data     
);
 
void gluTessEndPolygon(
  GLUtesselator * tess  
);
 

Parameters

tess
The tessellation object (created with gluNewTess).
polygon_data
A pointer to user-defined polygon data.

Remarks

The gluTessBeginPolygon and gluTessEndPolygon functions delimit the definition of a nonconvex polygon. Within each gluTessBeginPolygon/gluTessEndPolygon pair, include one or more calls to gluTessBeginContour/gluTessEndContour. Within each contour, there are zero or more calls to gluTessVertex. The vertices specify a closed contour (the last vertex of each contour is automatically linked to the first).

The polygon_data parameter is a pointer to a user-defined data structure. If the appropriate callbacks are specified (see gluTessCallback), this pointer is returned to the callback function or functions, making it a convenient way to store per-polygon information.

When you call gluTessEndPolygon, the polygon is tessellated, and the resulting triangles are described through callbacks. For descriptions of the callback functions, see gluTessCallback.

Example

The following describes a quadrilateral with a triangular hole:

gluTessBeginPolygon(tobj, NULL); 
  gluTessBeginContour(tobj); 
    gluTessVertex(tobj, v1, v1); 
    gluTessVertex(tobj, v2, v2); 
    gluTessVertex(tobj, v3, v3); 
    gluTessVertex(tobj, v4, v4); 
  gluTessEndContour(tobj); 
  gluTessBeginContour(tobj); 
    gluTessVertex(tobj, v5, v5); 
    gluTessVertex(tobj, v6, v6); 
    gluTessVertex(tobj, v7, v7); 
  gluTessEndContour(tobj); 
gluTessEndPolygon(tobj); 
  

QuickInfo

  Windows NT: Use version 3.5 and later.
  Windows: Use Windows 95 and later.
  Windows CE: Unsupported.
  Header: Declared in glu.h.
  Import Library: Link with glu32.lib.

See Also

gluNewTess, gluTessBeginContour, gluTessCallback, gluTessEndContour, gluTessNormal, gluTessProperty, gluTessVertex