The man pages say that the location of a uniform should be the value returned by glGetUniformLocation:
The location of the uniform variable to be modified is specified by location, which should be a value returned by glGetUniformLocation.
It later says that:
If location is equal to -1, the data passed in will be silently ignored and the specified uniform variable will not be changed.
What I would like to know is: is it safe to assign an uniform location at -1 by ourself, without using glGetAttribLocation. Or should this be avoided ?
Currently, I would like to assign some uniforms, but depending on some situations, the program can use different shaders, some requiring some uniforms, and other not requiring some.
I can modify the code to detect if the current shader needs all uniforms and call to glUniform only for the required ones, but currently this will imply some ‘annoying’ changes. And if it is safe to do as I asked for, then this will preserve me doing those changes.
What do you know about this ?
doc read here: http://www.opengl.org/sdk/docs/man/xhtml/glUniform.xml