#version 430 struct Light { vec3 ambient; }; #define MAX_LIGHTS 16 layout(location = 4) uniform Light lights[MAX_LIGHTS]; layout(location = 20) uniform uint num_lights; out vec4 frag_color; void main() { vec3 accum = vec3(0.0); for (uint i = 0; i < MAX_LIGHTS && i < num_lights; ++i) { accum = accum + lights[i].ambient; } frag_color = vec4(accum, 1.0); }