Hello.
I am learning GLSL shaders and i wrote very simply light system.
When I want add all lights by using variable like this:
int var = 10;
gl_FragColor = light[0];
for(int i = 1; i<var; i++)
gl_FragColor *= light[i]
I see graphics artifacts:
(http://pokaz.im/di-NYWL.jpg)
But when I write indexes manually (i use vars because i want add lights in loop, not manually) like this:
gl_FragColor = light[0] * light[1];
Everything works fine:
(http://pokaz.im/di-2GZ2.jpg)
Why I have artifacts?