- Home /
GLSL shader - array of uniform const
I need to pass multiple lights to my shader.
I coded my shader in CG/HLSL and it works fine. Now I need to convert it to GLSL and I don't know how to make an array of conts.
Here how it looks in HLSL (2 lights for an example, really there are more of them):
Properties {
_Light_0 ("Light", Vector) = (0.5, 0.5, 50, 0)
_Light_1 ("Light 1", Vector) = (0.5, 0.5, 50, 0)
...
}
...
CGPROGRAM
half4 _Light_0;
half4 _Light_1;
...
static half4 light_params[2] = { _Light_0, _Light_1 };
And then I'm accessing light's parameters by something like: light_params[n].
So, how it should look like in GLSL ?
I've tried the following code but it doesn't work:
uniform lowp vec4 _Light_0;
uniform lowp vec4 _Light_1;
const vec4 light_params[2] = vec4[2](_Light_0, _Light_1);
Comment