So, another question on shaders.
Well, its just that, is in the experimentations i had it seens that for each run( in this case, pixelwise, of the fragment shader), it seens to reset the variables to the original declared state of the headder.
shader_type canvas_item; varying float varvar; void fragment() { varvar += 2.;//This one changes the value, but for the whole screen, aka, every pixels get the null varvar+2 textex = texture(texarr, vec3(UV, mod(varvar,3)+0.0)); varvar += 2.;//This does nothing. and if used alone, trows error beacuse i think above line acess null value.
The result i was expecting was a mono-dimensional plot of the 3 textures across the whole UV map. But, insted, all point get the same value.
Soo, i guess it is reseting the variable for each fragment()run.
How to keep the value of the variable everincreasing?(even if it stackoverflow, that not a problem, i thinkg, beacuse if it round-robin, i an already putting it inside a mod operator, soo that fine i guess)
TLDR: How to keep a variable value across each run inside a shader?
Thanks for the help.