In the vertex shader I define a structure:
#version 110
struct LightSourceParameters {
vec4 ambient;
vec4 diffuse;
vec4 specular;
vec4 position;
};
and declare an instance for a single light
uniform LightSourceParameters light;
but when I try to get a parameter of the light, it fails ( i < 0 )
name = "light.ambient"
GLint i = glGetUniformLocation(program, name );
// i == -1
I know I cannot refer structures, but here I refer an exact field. What can be wrong?
~
Are you using that structure in the shader? If not, then the compiler is well within its rights to optimize the uniform out.