Setting Attributes
27
The first constructor allows you to specify the number of array primitives, n.
The second constructor allows you to reference an array, *array, of attribute values,
specify the offset, offset, if any, and the stride, stride.
The stride mechanism that lets an application choose to keep all data staggered in a
single array (or use two arrays). For example, you could combine color, vertex, and
coordinate data and access each type as needed using the stride number. Stride specifies
the byte offset between pointers to consecutive vertexes, in effect, stride is a relative
offset, as shown in Figure 2-5.
Figure 2-5 Stride and Offset Values
Set and Get Methods
Each of the virtual attribute-array classes, both the general and specific, have set and get
methods to set and return the values of the array. All set and get methods use the
following form:
void setCoordsSet(csCoordSet* coords);
csCoordSet* getCoordsSet();
data
offset 0
stride 12
XYZ
RGB
Nx Ny Nz
Tx Ty
XYZ
RGB
Nx Ny Nz
Tx Ty
CoordSet
(csData, offset, stride)
csData
data
offset 6
stride 12
NormalSet
(csData, offset, stride)