In the program that I'm coding, I have to generate multiple lights sources and pass is to the shader. As this number is defined outside the shader, I though to pass it through an uniform int
and use this to declare the arrays size.
uniform int numLights;
uniform vec4 ambientColor;
uniform vec4 specularColor;
uniform vec3 diffuseColor[numLights];
uniform vec3 vLightPosition[numLights];
However, I'm getting a lot of errors now:
Can't I do that? The thing is that I was thinking of the possibility of changing the number of predefined lights and to forget to update the shader, for example. My attempt was to prevent that to happen.