获取活跃一致变量的信息。变量可以在程序执行期间被访问,则该变量被认为是活动的
void glGetActiveUniform( GLuint program,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLint *size,
GLenum *type,
GLchar *name);
program
Specifies the program object to be queried.
指定着色器程序标识符
index
Specifies the index of the uniform variable to be queried.
指定一致变量的索引序号
bufSize
Specifies the maximum number of characters OpenGL is allowed to write in the character buffer indicated by name.
指定一致变量名的最大长度
length
Returns the number of characters actually written by OpenGL in the string indicated by name (excluding the null terminator) if a value other than NULL is passed.
获取一致变量名的实际长度,如果不需要获取长度,设置为NULL或0即可
size
Returns the size of the uniform variable.
获取一致变量的内存长度
type
Returns the data type of the uniform variable.
获取一致变量的类型,对应关系如下:
Returned Symbolic Contant Shader Uniform Type
GL_FLOAT float
GL_FLOAT_VEC2 vec2
GL_FLOAT_VEC3 vec3
GL_FLOAT_VEC4 vec4
GL_DOUBLE double
GL_DOUBLE_VEC2 dvec2
GL_DOUBLE_VEC3 dvec3
name
Returns a null terminated string containing the name of the uniform variable.
获取一致变量的名字