that coloured it green (So it sends the right data in)
float distance = length(lpos[i]-pos.xyz);
If i change that line to:
float distance = length(lpos[0]-pos.xyz);
it works fine for that one light but i can’t have multiple lights like this and why is there even a difference, the for loop starts with 0 and stops after that ???
Well, use the same approach to other variables, to (slowly) determine the values of them all, narrowing down the issue.
Okay, lpos[0] is 0,1,0 in this case:
gl_FragColor = vec4(lpos[0],1.0);
–> whole model is green (that’s what i expected)
But:
int c = 0;
gl_FragColor = vec4(lpos[c],1.0);
–> whole model is black (so values are 0,0,0 ??? when they should be 0,1,0)
But it’s both the same thing actually no?
Just testing out more stuff:
if(dis < light[i].range){
col = vec4(1.0,0.0,0.0,1.0);
}
crashing the code, while
if(dis < light[i].range){
}
col = vec4(1.0,0.0,0.0,1.0);
It doesn’t even give me an exception, just stops whole programm and throws an err.log file (Can upload if anyone is interested)
I don’t get it how GLSL works … -_-