We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm stilly reading the shader tutorial but it's so long that i already try out some stuff.
I'm wondering is something like this possible in the shader file:
uniform float fuzziness;
float minR, maxR, minG, maxG, minB, maxB;
void fuzziness(float v) {
fuzziness = v;
calcMinAndMax();
}
void calcMinAndMax() {
minR = color.r-fuzziness;
maxR = color.r+fuzziness;
minG = color.g-fuzziness;
maxG = color.g+fuzziness;
minB = color.b-fuzziness;
maxB = color.b+fuzziness;
}
And then call the fuzziness method from processing. Right now i get "The function targetColor(float, float, float) does not exist."
Answers
I'm pretty sure you can't — you can only pass values into the shader using set() then tell the shader to run. Processing can't access shader methods, nor can the shader access Processing methods, AFAIK.
Yeah i think the same :) I'm only not sure how main is running. Like if i drop this in main:
will those values be recalculated for every pixel?
That's my understanding, although I'm far from an expert. The fragment shader runs once for each fragment/pixel.