I’m trying to do something that I think many people want to do, but I have not found evidence that it is possible. I have had success terminating a for loop with a compile-time constant (preprocessor define NUM_LIGHTS), but I have not had good results when using an uniform to terminate the for loop in a fragment shader. I’m testing on a NVIDIA GeForce 8800 GTX, with very recent drivers. Thanks!
PS. For example, should this code work?
#define MAX_LIGHTS 4
#endif // MAX_LIGHTS
uniform vec4 light_position_vs[MAX_LIGHTS];
uniform int light_count;
for(unsigned int i=0; i<light_count; ++i)
vec4 L = light_position_vs[i];