How can I reach this light structure in my vertex shader?
struct LightInfo {
vec4 Position; // Light position in eye coords.
vec3 La; // Ambient light intensity
vec3 Ld; // Diffuse light intensity
vec3 Ls; // Specular light intensity
};
uniform LightInfo Light;
I tried:
shaderProgram.Light = gl.getUniformLocation(shaderProgram, "Light");
which compiles, but when I try to insert some value like:
gl.uniform4f(
shaderProgram.Light.Position,
parseFloat(document.getElementById("lightPositionX").value),
parseFloat(document.getElementById("lightPositionY").value),
parseFloat(document.getElementById("lightPositionZ").value),
0.0
);
It breaks completely. How would one send this position data into a shader structure?
you must get a location for each base type. In your example
Means you need
If you have arrays you’d need locations for each field of each array as in
And arrays of arrays etc.
etc…