Original Post
Hi, after creating an GLSL program I enumerate it's parameters using a simple "hacky" approach using glGetActiveUniformARB with increasing indices until I get an OpenGL error. Thus I have a list of all parameters of the current shader.
int index = 0;
while(true) {
GLsizei size, length;
GLenum type = 0;
GLchar name[NAME_SIZE];
glGetActiveUniformARB(program, index, NAME_SIZE, &length, &size, &type, name);
if( type == 0 ) {
break;
}
else {
// add to parameter list
}
++index;
}
This way I can successfully get all primitve parameters (int, vec2, samplers, ...). But I do not get array and struct parameters. Thus if I my shader contains the following paramters:
struct Foo {
vec2 xy;
};
uniform vec4 someColor;
uniform Foo foo;
uniform vec4[3] arr;
I will only find "someColor". Is there a way to enumerate parameters of complex types, too? I could not even find information about enumerating GLSL parameters, so maybe my aprroach is a bit hacky.. but still I consider it important that my program is able to find all shader parameters automatically. (And I'd prefer not having to parse the whole shaders.. ;)) thanks in advance, sheijk