Getting Uniform Locations

Hi… ive created some extremely simple GLSL shader. It links and compiles without any glError/Linker Error/Compile error for me. The problem is that glGetUniformLocationARB always returns -1, even tough the variables definately exist in the shader i passed to GL. Any ideas?

Since there isn’t much room for errors within glGetUniformLocationARB, only two things can happen : You didn’t wrote the parameter’s name casesensitive (e.g. texture0 instead of Texture0) or you have specified the wrong programobject.

Well i wrote the variable names correctly. As my program handle im getting a strange value ( hProgram==0x80000001 ) But commands like linking etc are obviously working because if i create some errors in the source, they are reported correctly. Also theres no glError being created when i call glCreateProgramObjectARB

[This message has been edited by Dtag (edited 12-31-2003).]

Are you sure that the programobject to which those parameters belong is the current? I’ve noticed that it won’t work if you pass parameters for PO1 if e.g. PO2 is bound, so make sure you make something like this :

glUseProgramObjectARB(ProgramObject);
glGetUniformLocationARB(ProgramObject, ...);

Yep im quite sure about that.
You can see my code here
http://www.pay4hits.de/glsl.txt
The uniform location is requested at the very end if linked is true…
Just for clarification: my shader files look like this:

[VP]
//VertexProgramHere
[FP]
//FragmentProgramHere
EOF

[This message has been edited by Dtag (edited 12-31-2003).]

Hmmm i just fixed the bug… It was because i didnt actually USE the uniform variables in the shader i just declared them … the compiler obviously optimized them away

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