glColorPointer - define an array of colors
void glColorPointer(GLint size,
GLenum type,
GLsizei stride,
const GLvoid * pointer)sizeSpecifies the number of components per color. Must be 4. The initial value is 4.
typeSpecifies the data type of each color component in the array. Symbolic constants GL_UNSIGNED_BYTE and GL_FIXED are accepted. However, the initial value is GL_FLOAT.
The common profile accepts the symbolic constant GL_FLOAT as well.
strideSpecifies the byte offset between consecutive colors. If stride is 0, the colors are understood to be tightly packed in the array. The initial value is 0.
pointerSpecifies a pointer to the first component of the first color element in the array.
glColorPointer specifies the location and data of an array of color components to use when rendering. size specifies the number of components per color, and must be 4. type specifies the data type of each color component, and stride specifies the byte stride from one color to the next allowing vertices and attributes to be packed into a single array or stored in separate arrays. (Single-array storage may be more efficient on some implementations.)
When a color array is specified, size, type, stride, and pointer are saved as client-side state.
If the color array is enabled, it is used when glDrawArrays, or glDrawElements is called. To enable and disable the color array, call glEnableClientState and glDisableClientState with the argument GL_COLOR_ARRAY. The color array is initially disabled and isn't accessed when glDrawArrays or glDrawElements is called.
Use glDrawArrays to construct a sequence of primitives (all of the same type) from prespecified vertex and vertex attribute arrays. Use glDrawElements to construct a sequence of primitives by indexing vertices and vertex attributes.
glColorPointer is typically implemented on the client side.
GL_INVALID_VALUE is generated if size is not 4.
GL_INVALID_ENUM is generated if type is not an accepted value.
GL_INVALID_VALUE is generated if stride is negative.
Copyright © 2003-2004 Silicon Graphics, Inc.
This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
glColor, glDrawArrays, glDrawElements, glEnableClientState, glNormalPointer, glTexCoordPointer, glVertexPointer