This abstract subclass of CC3VertexArray adds the functionality to draw the vertex data to the display through the GL engine. More...
#import <CC3VertexArrays.h>
Public Member Functions | |
(void) | - allocateStripLengths: |
(void) | - deallocateStripLengths |
(void) | - drawFrom:forCount:withVisitor: |
(void) | - drawWithVisitor: |
(GLsizei) | - faceCountFromVertexCount: |
(GLsizei) | - vertexCountFromFaceCount: |
Properties | |
GLenum | drawingMode |
GLuint | firstElement |
GLuint | stripCount |
GLuint * | stripLengths |
This abstract subclass of CC3VertexArray adds the functionality to draw the vertex data to the display through the GL engine.
The underlying data is drawn by invoking the drawWithVisitor: method, and can be drawn in a single GL call for all vertices, or the vertices can be arranged in strips, and the strips drawn serially.
You define vertex strips using the stripCount and stripLengths properties, or using the allocateStripLengths: method to set both properties at once.
Using vertex strips performs more GL calls, and will be less efficient, but in some applications, might assist in the organization of mesh vertex data.
Alternately, a subset of the vertices may be drawn by invoking the drawFrom:forCount:withVisitor: method instead of the drawWithVisitor: method.
- (void) allocateStripLengths: | (GLsizei) | sCount |
Sets the specified number of strips into the stripCount property, then allocates an array of Gluints of that length, and sets that array in the stripLengths property.
It is safe to invoke this method more than once. The previously allocated array of strip-lengths will be deallocated before the new array is created.
The array can be deallocated by invoking the deallocateStripLengths method.
- (void) deallocateStripLengths |
Deallocates the array of strip-lengths that was created by a previous invocation of the allocateStripLengths: method.
It is safe to invoke this method more than once, or even if allocateStripLengths: was not previously invoked.
This method is invoked automatically when this instance is deallocated.
- (void) drawFrom: | (GLuint) | vertexIndex | |
forCount: | (GLuint) | vertexCount | |
withVisitor: | (CC3NodeDrawingVisitor *) | visitor | |
Draws the specified number of vertices, starting at the specified vertex index, in a single GL draw call.
This method can be used to draw a subset of thevertices. This can be used when this array holds data for a number of meshes, or when data is being sectioned for palette matrices.
This abstract implementation collects drawing performance statistics if the visitor is configured to do so. Subclasses will override to perform appropriate drawing activity, but should also invoke this superclass implementation to perform the collection of performance data.
- (void) drawWithVisitor: | (CC3NodeDrawingVisitor *) | visitor |
Draws the elements, either in strips, or in a single call, depending on the value of the stripCount property.
This method is invoked automatically from the draw method of CC3VertexArrayMesh.
- (GLsizei) faceCountFromVertexCount: | (GLsizei) | vc |
Returns the number of faces to be drawn from the specified number of vertices, based on the drawing mode of this array.
- (GLsizei) vertexCountFromFaceCount: | (GLsizei) | fc |
Returns the number of vertices required to draw the specified number of faces, based on the drawing mode of this array.
- (GLenum) drawingMode [read, write, assign] |
The drawing mode indicating how the vertices are connected (points, lines, triangles...).
This must be set with a valid GL drawing mode enumeration.
The default value is GL_TRIANGLE_STRIP.
- (GLuint) firstElement [read, assign] |
An index reference to the first element that will be drawn.
This abstract implementation always returns zero. Subclasses will override.
Implemented in CC3VertexLocations.
- (GLuint) stripCount [read, write, assign] |
The underlying data can be drawn in strips, using multiple GL calls, rather than a single call.
This property indicates the number of strips to draw. A value of zero indicates that vertex drawing should be done in a single GL call.
- (GLuint *) stripLengths [read, write, assign] |
An array of values, each indicating the number of elements to draw in the corresponding strip.
The stripCount property indicates the number of items in this array. If drawing is not performed in strips (stripCount is zero), this property will be NULL.
An easy way to create a suitable array for this property, and set the associated stripCount property at the same time, is to invoke the allocateStripLengths: method.