Export (0) Print
Expand All

Tessellating Polygons

OpenGL can directly display only simple convex polygons. A polygon is simple if:

  • The edges intersect only at vertices.
  • There are no duplicate vertices.
  • Exactly two edges meet at any vertex.

To display simple nonconvex polygons or simple polygons containing holes, you must first triangulate the polygons (subdivide them into convex polygons). Such subdivision is called tessellation. GLU provides a collection of functions that perform tessellation. Note that the GLU tessellation functions can't handle nonsimple polygons; there is no standard OpenGL method to handle such polygons.

Because tessellation is often required and can be rather tricky, this section describes the GLU tessellation functions in detail. These functions take as input arbitrary simple polygons that might include holes, and they return some combination of triangles, triangle meshes, and triangle fans. If you don't want to deal with meshes or fans, you can specify that the tessellation functions return only triangles. However, mesh and fan information improves performance. The polygon tessellation functions triangulate a concave polygon with one or more contours.

Dd369062.wedge(en-us,VS.85).gifTo use polygon tessellation

  1. Create a tessellation object with gluNewTess.
  2. Use gluTessCallBack to define callback functions you will use to process the triangles generated by the tessellator.
  3. With gluBeginPolygon, gluTessVertex, gluNextContour, and gluEndPolygon, specify the polygon with holes or the concave polygon to be tessellated.

    When the polygon description is complete, the tessellation facility invokes your callback functions as necessary.

    You can destroy unneeded tessellation objects with gluDeleteTess.

For more information on saving the tessellation data, see Using Callback Functions.

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Community Additions

ADD
Show:
© 2014 Microsoft