Graphics Reference
In-Depth Information
index
specifies the vertex attribute to query and will be a
value between 0 and
GL_ACTIVE_ATTRIBUTES
- 1. The
value of
GL_ACTIVE_ATTRIBUTES
is determined with
glGetProgramiv
.
bufsize
specifies the maximum number of characters that may be
written into
name
, including the null terminator.
length
returns the number of characters written into
name
,
excluding the null terminator, if
length
is not
NULL
.
type
returns the type of the attribute. Valid values are
GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3,
GL_FLOAT_VEC4, GL_FLOAT_MAT2, GL_FLOAT_MAT3,
GL_FLOAT_MAT4, GL_FLOAT_MAT2x3, GL_FLOAT_MAT2x4,
GL_FLOAT_MAT3x2, GL_FLOAT_MAT3x4, GL_FLOAT_MAT4x2,
GL_FLOAT_MAT_4x3, GL_INT, GL_INT_VEC2, GL_INT_VEC3,
GL_INT_VEC4, GL_UNSIGNED_INT, GL_UNSIGNED_INT_VEC2,
GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4
size
returns the size of the attribute. This is specified in units of
the type returned by
type
. If the variable is not an array,
size
will always be 1. If the variable is an array, then
size
returns the size of the array.
name
name of the attribute variable as declared in the vertex
shader.
The
glGetActiveAttrib
call provides information about the attribute
selected by
index
. As detailed in the description of
glGetActiveAttrib
,
index
must be a value between 0 and
GL_ACTIVE_ATTRIBUTES
- l. The
value of
GL_ACTIVE_ATTRIBUTES
is queried using
glGetProgramiv
.
An
index
of
0
selects the first active attributes, and an
index
of
GL_ACTIVE_ATTRIBUTES - 1
selects the last vertex attribute.
in a Vertex Shader
We discussed earlier that in a vertex shader, vertex attribute variables
are specified by the
in
qualifier, the number of active attributes can
be queried using
glGetProgramiv
, and the list of active attributes
in a program can be queried using
glGetActiveAttrib
. We also
described how generic attribute indices that range from 0 to
(
GL_MAX_VERTEX_ATTRIBS
- 1) are used to enable a generic vertex