I made a wrapper class for shaders in Java and added following method to set value to floating uniform variables in my vertex shader program:
public boolean setUniformVariable( String name, float var )
{
int var_location = gl.glGetUniformLocation( program, name );
if( var_location == -1 ) return false;
gl.glUniform1f( var_location, var );
return true;
}
Everything else in my class works. That is I can compile shaders, bind them to int program and use them in the rest of my application.
In the vertex program i declare uniform float time; at the top, and then try to set a value to it on display call. but this function (setUniformVariable) always returns false, meaning that glGetUniformLocation is not finding the variable.
What is going on here?