csGeoSet Attributes
21
For example, a single color can be specified for the entire collection of primitives, for
individual primitives, or per vertex. One set of coordinates, on the other hand, cannot be
specified for the entire collection of primitives, cannot be specified for individual
primitives, but must be specified per vertex. It does not make sense for all of the
primitives in a collection to have the same coordinates, nor does it make sense for all
vertices in each primitive to have the same coordinates. Each vertex must have its own
coordinates.
Each level of specificity is called a different binding, for example, an attribute that is
specified for an entire collection of primitives is said to have an OVERALL binding. A
binding tells you how many primitives in a csGeoSet object an attribute applies to.
Table 2-3 shows the different possible bindings.
All attributes in a csGeoSet collection must share the same set of attribute bindings, for
example, you cannot specify colors-per-vertex for some primitives and
colors-per-primitive for others in the same csGeoSet object, the color binding must be the
same. You can, however, have, for example, color-per-vertex and overall normal
bindings in the same csGeoSet.
Setting Attribute Bindings
Three set...() methods in csGeoSet specify the attribute bindings for a csGeoSet object:
void setNormalBind(NormalBindEnum normalBind);
void setColorBind(ColorBindEnum colorBind);
void setTexCoordBind(TexCoordBindEnum texCoordBind);
There is a corresponding set of get...() methods that retrieve the attribute bindings for the
normals, colors, and texture coordinates, respectively.
Table 2-3 Attribute Bindings
OFF OVERALL PER_PRIMITIVE PER_VERTEX
colors yes yes yes yes
normals yes yes yes yes
texture coordinates yes no no yes
coordinates no no no yes