I'd like to get a list of all the uniforms & attribs used by a shader program object. glGetAttribLocation()
& glGetUniformLocation()
can be used to map a string to a location, but what I would really like is the list of strings without having to parse the glsl code.
Note: In OpenGL 2.0 glGetObjectParameteriv()
is replaced by glGetProgramiv()
. And the enum is GL_ACTIVE_UNIFORMS
& GL_ACTIVE_ATTRIBUTES
.
Best Answer
Variables shared between both examples:
Attributes
Uniforms
OpenGL Documentation / Variable Types
The various macros representing variable types can be found in the docs. Such as
GL_FLOAT
,GL_FLOAT_VEC3
,GL_FLOAT_MAT4
, etc.