📄 colorpointer.html
字号:
<HTML>
<BODY>
<PRE>
<STRONG>NAME</STRONG>
<STRONG>glColorPointer</STRONG> - define an array of colors
<STRONG>C</STRONG> <STRONG>SPECIFICATION</STRONG>
void <STRONG>glColorPointer</STRONG>( GLint <EM>size</EM>,
GLenum <EM>type</EM>,
GLsizei <EM>stride</EM>,
const GLvoid *<EM>pointer</EM> )
<STRONG>PARAMETERS</STRONG>
<EM>size</EM> Specifies the number of components per color. Must
be 3 or 4.
<EM>type</EM> Specifies the data type of each color component in
the array. Symbolic constants <STRONG>GL_BYTE</STRONG>,
<STRONG>GL_UNSIGNED_BYTE</STRONG>, <STRONG>GL_SHORT</STRONG>, <STRONG>GL_UNSIGNED_SHORT</STRONG>,
<STRONG>GL_INT</STRONG>, <STRONG>GL_UNSIGNED_INT</STRONG>, <STRONG>GL_FLOAT</STRONG>, and <STRONG>GL_DOUBLE</STRONG>
are accepted.
<EM>stride</EM> Specifies the byte offset between consecutive
colors. If <EM>stride</EM> is 0, (the initial value), the
colors are understood to be tightly packed in the
array.
<EM>pointer</EM> Specifies a pointer to the first component of the
first color element in the array.
<STRONG>DESCRIPTION</STRONG>
<STRONG>glColorPointer</STRONG> specifies the location and data format of an
array of color components to use when rendering. <EM>size</EM>
specifies the number of components per color, and must be 3
or 4. <EM>type</EM> specifies the data type of each color component,
and <EM>stride</EM> specifies the byte stride from one color to the
next allowing vertexes and attributes to be packed into a
single array or stored in separate arrays. (Single-array
storage may be more efficient on some implementations; see
<STRONG>glInterleavedArrays</STRONG>.)
When a color array is specified, <EM>size</EM>, <EM>type</EM>, <EM>stride</EM>, and
<EM>pointer</EM> are saved as client-side state.
To enable and disable the color array, call
<STRONG>glEnableClientState</STRONG> and
<STRONG>glDisableClientState</STRONG> with the argument <STRONG>GL_COLOR_ARRAY</STRONG>. If
enabled, the color array is used when <STRONG>glDrawArrays</STRONG>,
<STRONG>glDrawElements</STRONG>, or <STRONG>glArrayElement</STRONG> is called.
<STRONG>NOTES</STRONG>
<STRONG>glColorPointer</STRONG> is available only if the GL version is 1.1 or
greater.
The color array is initially disabled and isn't accessed
when <STRONG>glArrayElement</STRONG>, <STRONG>glDrawArrays</STRONG>, or <STRONG>glDrawElements</STRONG> is
called.
Execution of <STRONG>glColorPointer</STRONG> is not allowed between the
execution of <STRONG>glBegin</STRONG> and the corresponding execution of
<STRONG>glEnd</STRONG>, but an error may or may not be generated. If no error
is generated, the operation is undefined.
<STRONG>glColorPointer</STRONG> is typically implemented on the client side.
Color array parameters are client-side state and are
therefore not saved or restored by <STRONG>glPushAttrib</STRONG> and
<STRONG>glPopAttrib</STRONG>. Use <STRONG>glPushClientAttrib</STRONG> and <STRONG>glPopClientAttrib</STRONG>
instead.
<STRONG>ERRORS</STRONG>
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>size</EM> is not 3 or 4.
<STRONG>GL_INVALID_ENUM</STRONG> is generated if <EM>type</EM> is not an accepted
value.
<STRONG>GL_INVALID_VALUE</STRONG> is generated if <EM>stride</EM> is negative.
<STRONG>ASSOCIATED</STRONG> <STRONG>GETS</STRONG>
<STRONG>glIsEnabled</STRONG> with argument <STRONG>GL_COLOR_ARRAY</STRONG>
<STRONG>glGet</STRONG> with argument <STRONG>GL_COLOR_ARRAY_SIZE</STRONG>
<STRONG>glGet</STRONG> with argument <STRONG>GL_COLOR_ARRAY_TYPE</STRONG>
<STRONG>glGet</STRONG> with argument <STRONG>GL_COLOR_ARRAY_STRIDE</STRONG>
<STRONG>glGetPointerv</STRONG> with argument <STRONG>GL_COLOR_ARRAY_POINTER</STRONG>
<STRONG>SEE</STRONG> <STRONG>ALSO</STRONG>
<STRONG>glArrayElement</STRONG>, <STRONG>glDrawArrays</STRONG>, <STRONG>glDrawElements</STRONG>,
<STRONG>glEdgeFlagPointer</STRONG>,
<STRONG>glEnable</STRONG>, <STRONG>glGetPointerv</STRONG>, <STRONG>glIndexPointer</STRONG>,
<STRONG>glInterleavedArrays</STRONG>, <STRONG>glNormalPointer</STRONG>, <STRONG>glPopClientAttrib</STRONG>,
<STRONG>glPushClientAttrib</STRONG>, <STRONG>glTexCoordPointer</STRONG>, <STRONG>glVertexPointer</STRONG>
</PRE>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -