Hi,

Your problem is that the shader is not bound (use something like
glUseProgram(blah)) when you try to get the variable.

In your second code, -1 means that the variable does not exist in the shader
(i.e., the compiler optimized it out, because it's not used).  Notice that
the variable "colorr" is declared in two different scopes, which is why the
compiler optimized out the uniform (because the local variable masks it).

When setting colors, it's a good idea to specify the alpha component too.
Although it seems to work now, as I recall, gl_FragColor is actually
undefined until set.

Ian

Reply via email to