hwTriangles - define one or more triangles
| Data | *F | The list of vertices (3 for each triangle), with from 3 to 11 floats per vertex |
| OptFlags | 1I | Optimization flags; see hw for details |
| Indices | *I | (Optional) An array of indices which specifies triads of vertex numbers to use in constructing the triangles. If specified, must be a multiple of 3 in length. Note that vertices are numbered starting with 0. |
| OptFlags | hwDefaultOptFlags |
| Data | NULL |
| Indices | NULL |
The hwTriangles class takes a list of vertices and displays them as a number of closed polygonal surfaces. The Data pointer is an array of hwFloat values; if Indices are not specified, then the number of values must be equal to 3*n*FPV, where FPV is the number of hwFloats present per vertex as described by the hwVertex man page. If Indicies
/* Draw a square two-sided polygon, using two triangles */
hwObject
tris;
hwFloat
verts[] = {0,0,0, 0,1,0, 1,1,0,
1,1,0, 1,0,0, 0,0,0};
tris = hwTriangles->create( hwTriangles );
tris->modify( tris, hwStrData, HW_MAKE_TYPE(HW_TYPE_FLOAT,2*3*3), verts );
HW_MODIFY_1B( tris, hwStrTwoSided, HW_TRUE );
tris->draw( tris );
tris->destroy( tris );
# A square two-sided polygon using two triangles
hwTriangles tris {
TwoSided = True
Data = {0,0,0, 0,1,0, 1,1,0,
1,1,0, 1,0,0, 0,0,0}
}