In OpenGLES 2 glGetUniformLocation receives the program id and a string as parameters. It then attempts to return a location int that can be used to set uniform GLSL shader variables.
If the variable is found it will return a 0 or positive value. If it fails to find the uniform variable it will return -1.
In C++ we should initialize the location ints in the ctr. If we don’t initialize the locations we might have garbage values when in Release mode.
Using the locations with garbage values might overwrite uniform variables with values we did not intend them to have.
So what we should initialize the locations with? One might think that 0 is a good value to initialize but it is not.
Remember! 0 is a valid shader uniform variable location. If we set all the locations to 0 we might overwrite the uniform variable at location 0.
We should initialize the location ints with -1.
We should do this because -1 is the value that is returned in case the uniform variable was not found and setting a value at location -1 will be ignored.