1GLCOLORPOINTER(3G) GLCOLORPOINTER(3G)
2
3
4
6 glColorPointer - define an array of colors
7
8
10 void glColorPointer( GLint size,
11 GLenum type,
12 GLsizei stride,
13 const GLvoid *ptr )
14
15
17 size Specifies the number of components per color. Must be 3 or 4.
18 The initial value is 4.
19
20 type Specifies the data type of each color component in the array.
21 Symbolic constants GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT,
22 GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, and
23 GL_DOUBLE are accepted. The initial value is GL_FLOAT.
24
25 stride Specifies the byte offset between consecutive colors. If
26 stride is 0 (the initial value), the colors are understood to
27 be tightly packed in the array. The initial value is 0.
28
29 ptr Specifies a pointer to the first component of the first color
30 element in the array.
31
33 glColorPointer specifies the location and data of an array of color
34 components to use when rendering. size specifies the number of compo‐
35 nents per color, and must be 3 or 4. type specifies the data type of
36 each color component, and stride specifies the byte stride from one
37 color to the next allowing vertices and attributes to be packed into a
38 single array or stored in separate arrays. (Single-array storage may
39 be more efficient on some implementations; see glInterleavedArrays.)
40
41 When a color array is specified, size, type, stride, and ptr are saved
42 as client-side state.
43
44 To enable and disable the color array, call glEnableClientState and
45 glDisableClientState with the argument GL_COLOR_ARRAY. If enabled, the
46 color array is used when glDrawArrays, glDrawElements,
47 glDrawRangeElements, or glArrayElement is called.
48
50 glColorPointer is available only if the GL version is 1.1 or greater.
51
52 The color array is initially disabled and isn't accessed when
53 glArrayElement, glDrawArrays, glDrawRangeElements, or glDrawElements is
54 called.
55
56 Execution of glColorPointer is not allowed between the execution of
57 glBegin and the corresponding execution of glEnd, but an error may or
58 may not be generated. If no error is generated, the operation is unde‐
59 fined.
60
61 glColorPointer is typically implemented on the client side.
62
63 Color array parameters are client-side state and are therefore not
64 saved or restored by glPushAttrib and glPopAttrib. Use
65 glPushClientAttrib and glPopClientAttrib instead.
66
68 GL_INVALID_VALUE is generated if size is not 3 or 4.
69
70 GL_INVALID_ENUM is generated if type is not an accepted value.
71
72 GL_INVALID_VALUE is generated if stride is negative.
73
75 glIsEnabled with argument GL_COLOR_ARRAY
76 glGet with argument GL_COLOR_ARRAY_SIZE
77 glGet with argument GL_COLOR_ARRAY_TYPE
78 glGet with argument GL_COLOR_ARRAY_STRIDE
79 glGetPointerv with argument GL_COLOR_ARRAY_POINTER
80
82 glArrayElement(3G), glDrawArrays(3G), glDrawElements(3G),
83 glEdgeFlagPointer(3G), glEnable(3G), glGetPointerv(3G),
84 glIndexPointer(3G), glInterleavedArrays(3G), glNormalPointer(3G),
85 glPopClientAttrib(3G), glPushClientAttrib(3G), glTexCoordPointer(3G),
86 glVertexPointer(3G)
87
88
89
90 GLCOLORPOINTER(3G)