Code: Select all
shad = lg.newShader([[
extern vec2 points[]; //It's supposed to be a array which holds points in the screen
extern vec4 colors[]; //supposed to be the color of the points
extern int pointsAmount; // amount of points
number di = 100000; //the smallest distance to the pixel
int point = 0.; // the point which is closest to the pixel
vec4 effect(vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords) // line that the error occurs aparently
for(int i = 0; i<pointsAmount; i++){
number dista = ((screen_coords[1]-points[i][1])^2 - (screen_coords[2]-points[i][2])^2);
if dista < di then
di = dista;
point = i;
}
}]])
As you can see, the problem is in the newShader function. So there's nothing to do with the externals or anything else really. What's the problem in the code? Again, this is pretty much the first code I'm doing in GLSL, please be patient D:Cannot compile pixel shader code:
Line 8: error: syntax error, unexpected reserved word "for", expecting ',' or ';' at token "for"