Performer uses two major classes for its drawing primitives:
pfGeoSet:
A geoset is a collection of one or more primitives of a certain type.
The primitive types available are:
pfGeoSet data includes:
Vertex coordinates are required. All other attributes are optional.
Attributes can be indexed or non-indexed. Stick with non-indexed.
Attributes other than vertex coordinates can be defined "overall", "per primitive", or "per vertex". Individual attributes can be defined differently; i.e. a geoset can have per-vertex normals and per-primitive colors.
PFGS_OVERALL:
PFGS_PER_PRIM:
PFGS_PER_VERTEX:
PrimType: PFGS_TRISTRIPS
NumPrims: 3
PrimLengths: { 5, 4, 4 }
Attributes:
Skeletal C++ code:
geoset->setPrimType(PFGS_TRISTRIPS); geoset->setNumPrims(3); /* Create "lengths" - array of 3 int's */ geoset->setPrimLengths(lengths); /* Create "vertices" - array of 13 pfVec3's */ geoset->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, vertices, NULL); /* Create "normals" - array of 13 pfVec3's */ geoset->setAttr(PFGS_NORMAL3, PFGS_PER_VERTEX, normals, NULL); /* Create "colors" - array of 3 pfVec4's */ geoset->setAttr(PFGS_COLOR4, PFGS_PER_PRIM, colors, NULL);
Encapsulates the GL rendering state to be applied to a geoset.
Anything left undefined is inherited from the global geostate.
Modes:
pfMaterial
pfTexture
texture->loadImage("file.rgb")
texture->setImage(image, 4, x, y, 1);
The example class strip creates a geoset containing a single triangle strip. The length of the strip can be set by the "length" message, and an optional texture map can be given by the "texture" message.