Light | Dark

glGetActiveUniformsiv

Name

glGetActiveUniformsiv — Returns information about several active uniform variables for the specified program object

C Specification

void glGetActiveUniformsiv(GLuint program,
GLsizei uniformCount,
const GLuint *uniformIndices,
GLenum pname,
GLint *params);

Parameters

program

Specifies the program object to be queried.

uniformCount

Specifies both the number of elements in the array of indices uniformIndices and the number of parameters written to params upon successful return.

uniformIndices

Specifies the address of an array of uniformCount integers containing the indices of uniforms within program whose parameter pname should be queried.

pname

Specifies the property of each uniform in uniformIndices that should be written into the corresponding element of params.

params

Specifies the address of an array of uniformCount integers which are to receive the value of pname for each uniform in uniformIndices.

Description

glGetActiveUniformsiv queries the value of the parameter named pname for each of the uniforms within program whose indices are specified in the array of uniformCount unsigned integers uniformIndices. Upon success, the value of the parameter for each uniform is written into the corresponding entry in the array whose address is given in params. If an error is generated, nothing is written into params.

If pname is GL_UNIFORM_TYPE, then an array identifying the types of uniforms specified by the corresponding array of uniformIndices is returned. The returned types can be any of the values from the following table:

Returned Symbolic Contant Shader Uniform Type
GL_FLOAT float
GL_FLOAT_VEC2 vec2
GL_FLOAT_VEC3 vec3
GL_FLOAT_VEC4 vec4
GL_INT int
GL_INT_VEC2 ivec2
GL_INT_VEC3 ivec3
GL_INT_VEC4 ivec4
GL_UNSIGNED_INT unsigned int
GL_UNSIGNED_INT_VEC2 uvec2
GL_UNSIGNED_INT_VEC3 uvec3
GL_UNSIGNED_INT_VEC4 uvec4
GL_BOOL bool
GL_BOOL_VEC2 bvec2
GL_BOOL_VEC3 bvec3
GL_BOOL_VEC4 bvec4
GL_FLOAT_MAT2 mat2
GL_FLOAT_MAT3 mat3
GL_FLOAT_MAT4 mat4
GL_FLOAT_MAT2x3 mat2x3
GL_FLOAT_MAT2x4 mat2x4
GL_FLOAT_MAT3x2 mat3x2
GL_FLOAT_MAT3x4 mat3x4
GL_FLOAT_MAT4x2 mat4x2
GL_FLOAT_MAT4x3 mat4x3
GL_SAMPLER_1D sampler1D
GL_SAMPLER_2D sampler2D
GL_SAMPLER_3D sampler3D
GL_SAMPLER_CUBE samplerCube
GL_SAMPLER_1D_SHADOW sampler1DShadow
GL_SAMPLER_2D_SHADOW sampler2DShadow
GL_SAMPLER_1D_ARRAY sampler1DArray
GL_SAMPLER_2D_ARRAY sampler2DArray
GL_SAMPLER_1D_ARRAY_SHADOW sampler1DArrayShadow
GL_SAMPLER_2D_ARRAY_SHADOW sampler2DArrayShadow
GL_SAMPLER_2D_MULTISAMPLE sampler2DMS
GL_SAMPLER_2D_MULTISAMPLE_ARRAY sampler2DMSArray
GL_SAMPLER_CUBE_SHADOW samplerCubeShadow
GL_SAMPLER_BUFFER samplerBuffer
GL_SAMPLER_2D_RECT sampler2DRect
GL_SAMPLER_2D_RECT_SHADOW sampler2DRectShadow
GL_INT_SAMPLER_1D isampler1D
GL_INT_SAMPLER_2D isampler2D
GL_INT_SAMPLER_3D isampler3D
GL_INT_SAMPLER_CUBE isamplerCube
GL_INT_SAMPLER_1D_ARRAY isampler1DArray
GL_INT_SAMPLER_2D_ARRAY isampler2DArray
GL_INT_SAMPLER_2D_MULTISAMPLE isampler2DMS
GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY isampler2DMSArray
GL_INT_SAMPLER_BUFFER isamplerBuffer
GL_INT_SAMPLER_2D_RECT isampler2DRect
GL_UNSIGNED_INT_SAMPLER_1D usampler1D
GL_UNSIGNED_INT_SAMPLER_2D usampler2D
GL_UNSIGNED_INT_SAMPLER_3D usampler3D
GL_UNSIGNED_INT_SAMPLER_CUBE usamplerCube
GL_UNSIGNED_INT_SAMPLER_1D_ARRAY usampler2DArray
GL_UNSIGNED_INT_SAMPLER_2D_ARRAY usampler2DArray
GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE usampler2DMS
GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY usampler2DMSArray
GL_UNSIGNED_INT_SAMPLER_BUFFER usamplerBuffer
GL_UNSIGNED_INT_SAMPLER_2D_RECT usampler2DRect

If pname is GL_UNIFORM_SIZE, then an array identifying the size of the uniforms specified by the corresponding array of uniformIndices is returned. The sizes returned are in units of the type returned by a query of GL_UNIFORM_TYPE. For active uniforms that are arrays, the size is the number of active elements in the array; for all other uniforms, the size is one.

If pname is GL_UNIFORM_NAME_LENGTH, then an array identifying the length, including the terminating null character, of the uniform name strings specified by the corresponding array of uniformIndices is returned.

If pname is GL_UNIFORM_BLOCK_INDEX, then an array identifying the the uniform block index of each of the uniforms specified by the corresponding array of uniformIndices is returned. The uniform block index of a uniform associated with the default uniform block is -1.

If pname is GL_UNIFORM_OFFSET, then an array of uniform buffer offsets is returned. For uniforms in a named uniform block, the returned value will be its offset, in basic machine units, relative to the beginning of the uniform block in the buffer object data store. For uniforms in the default uniform block, -1 will be returned.

If pname is GL_UNIFORM_ARRAY_STRIDE, then an array identifying the stride between elements, in basic machine units, of each of the uniforms specified by the corresponding array of uniformIndices is returned. The stride of a uniform associated with the default uniform block is -1. Note that this information only makes sense for uniforms that are arrays. For uniforms that are not arrays, but are declared in a named uniform block, an array stride of zero is returned.

If pname is GL_UNIFORM_MATRIX_STRIDE, then an array identifying the stride between columns of a column-major matrix or rows of a row-major matrix, in basic machine units, of each of the uniforms specified by the corresponding array of uniformIndices is returned. The matrix stride of a uniform associated with the default uniform block is -1. Note that this information only makes sense for uniforms that are matrices. For uniforms that are not matrices, but are declared in a named uniform block, a matrix stride of zero is returned.

If pname is GL_UNIFORM_IS_ROW_MAJOR, then an array identifying whether each of the uniforms specified by the corresponding array of uniformIndices is a row-major matrix or not is returned. A value of one indicates a row-major matrix, and a value of zero indicates a column-major matrix, a matrix in the default uniform block, or a non-matrix.

Errors

GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.

GL_INVALID_OPERATION is generated if program is not a program object.

GL_INVALID_VALUE is generated if uniformCount is greater than or equal to the value of GL_ACTIVE_UNIFORMS for program.

GL_INVALID_ENUM is generated if pname is not an accepted token.

Associated Gets

glGet with argument GL_MAX_VERTEX_UNIFORM_COMPONENTS, GL_MAX_GEOMETRY_UNIFORM_COMPONENTS, GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS, GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS.

glGetProgram with argument GL_ACTIVE_UNIFORMS or GL_ACTIVE_UNIFORM_MAX_LENGTH.

glIsProgram

Think you can improve this page? Edit this page on GitHub.