How to enumerate uniform variables?

Hi

Is there any way in GLSL to enumerate (used) uniform variables ?
for example i have this glsl shader:

uniform vec4 some_var;
void main(void)
{
 gl_FragColor = some_var;
}

now if i know the variable name ‘in advance’
i could get it’s location by
glGetUniformLocation(my_program, “some_var”);

but is there any way to enumerate ALL (used) uniform variables that shader have ?
(something like cgGetFirstParameter/cgGetNextParameter ?)
and idealy know their types (float, vec2, sampler3D, etc.)

CG is realy broken in terms of GLSL profiles
and without those it is unusable on ATI cards
so I’m looking for replacement.
I do not use CG-FX - just the CG - i could easily port my shaders to GLSL - but i need a way to enumerate their uniforms to not hardcode them.

You can do it with glGetActiveUniform function.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.