Performer Graphics Primitives

Performer uses two major classes for its drawing primitives:
pfGeoSet:

Geometry (points, normals, colors, texture coordinates)

pfGeoState:
Materials
Texture maps
and other drawing state (transparency, fog, etc.)


pfGeoSet

A geoset is a collection of one or more primitives of a certain type.

The primitive types available are:


pfGeoSet data includes:

Items in bold must be defined. Everything else is optional (the geostate is theoretically optional, but you can get unpredictable results if it's not defined). All arrays must be pfMalloc'ed.


pfGeoSet Attributes

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:


Example Geoset

PrimType: PFGS_TRISTRIPS
NumPrims: 3
PrimLengths: { 5, 4, 4 }

Attributes:

PFGS_COORD3, PFGS_PER_VERTEX, { {x,y,z}1, ..., {x,y,z}13 }
PFGS_NORMAL3, PFGS_PER_VERTEX, { {x,y,z}1, ..., {x,y,z}13 }
PFGS_COLOR4, PFGS_PER_PRIM, { {r,g,b,a}, {r,g,b,a}, {r,g,b,a} }
PFGS_TEXCOORD2, PFGS_OFF

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);


pfGeoState

Encapsulates the GL rendering state to be applied to a geoset. Anything left undefined is inherited from the global geostate.

Modes:

Attributes:


pfMaterial

pfTexture

Can load an RGB image file via
		texture->loadImage("file.rgb") 
or define an image dynamically and use
		texture->setImage(image, 4, x, y, 1); 


Example Ygdrasil Class

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.


Last modified 27 July 2001.
Dave Pape, pape@evl.uic.edu