Convex Polygons |
A polygon is a planar area enclosed by a closed loop of line segments, specified by their endpoints.
While the Voodoo Graphics hardware does not render polygons directly, Glide provides a set of polygon rendering functions that are optimized for the hardware. The polygons rendered by the Glide functions are subject to some strong restrictions:Figure 4.3 shows some examples of both valid and invalid polygons.The edges of the polygon cannot intersect. The polygon must be convex, that is, have no indentations. (The glossary at the end of this manual gives a precise definition of convexity.)
Figure 4.3 Polygons.
![]()
The convex polygons rendered by Glide are assumed to be planar in co-ordinate space.
Two polygon rendering routines (grDrawPlanarPolygon() and grDrawPlanarPolygonVertexList()) requires that the rendering parameters
(r, g, b, a, ooz, oow, sow, tow) be planar as well.
None of the polygon rendering functions do any geometric clipping.
void grDrawPlanarPolygon(int nVerts, int ilist[], const GrVertex vlist[]) |
void grDrawPolygon( int nVerts, int ilist[], const GrVertex vlist[] ) |
grDrawPlanarPolygon() and grDrawPolygon() both render a convex polygon with nVerts vertices. The second argument, ilist, is an array of indices into the list of vertices provided in the third argument. This level of indirection in specifying vertices is useful if you need to pre-process the list to do geometric clipping or hidden surface removal. The preprocessor can create the ilist for you rather than copying selected vertices to a new list.grDrawPlanarPolygon() assumes that the vertex parameters for the polygon are planar. Parameter gradients will be calculated only once for the entire polygon, thus reduce the number of calculations significantly.
Another pair polygon rendering functions defined in Glide, grDrawPlanarPolygonVertexList() and grDrawPolygonVertexList(), are functionally equivalent to grDrawPlanarPolygon () and grDrawPolygon() respectively. The difference between the two pairs of routines is the way the vertices are specified.
void grDrawPlanarPolygonVertexList( int nVerts, const GrVertex vlist[] ) |
void grDrawPolygonVertexList( int nVerts, const GrVertex vlist[] ) |
There is no level of indirection in grDrawPlanarPolygonVertexList() and grDrawPolygonVertexList().The ith vertex of the polygon passed to these routines is vlist[i], assuming that
0<= I <nVerts , whereas the ith vertex of a polygon passed to grDrawPlanarPolygon() or grDrawPolygon() is vlist[ilist[i]].
Chapter 4
next: Backface Culling