hwPolygon - define a closed, convex polygon
Data | *F | The list of vertices, with from 3 to 11 floats per vertex |
OptFlags | 1I | Optimization flags; see hw for details |
OptFlags | hwDefaultOptFlags |
Data | NULL |
The hwPolygon class takes a list of vertices and displays them as a closed polygonal surface. The parameters Data must be an array of hwFloat values; the number of values must be equal to n*FPV, where FPV is the number of hwFloats present per vertex as described by the hwVertex man page. The number n is derived from the size of the Data array, and is the number of vertices in the polygon.
NOTE: As of this writing, non-convex polygons result in system-dependent behavior, and are discouraged, as are non-planar polygons.
/* Draw a square two-sided polygon */ hwObject poly; hwFloat verts[] = {0,0,0, 0,1,0, 1,1,0, 1,0,0}; poly = hwPolygon->create( hwPolygon ); poly->modify( poly, hwStrData, HW_MAKE_TYPE(HW_TYPE_FLOAT,4*3), verts ); HW_MODIFY_1B( poly, hwStrTwoSided, HW_TRUE ); poly->draw( poly ); poly->destroy( poly );
# A square two-sided polygon hwPolygon poly { TwoSided = True Data = {0,0,0, 0,1,0, 1,1,0, 1,0,0} }