hello,
I just try to do a simple mix-shader: multiply the texture by an amount to make some fades.
but nothing occurs.
here's my glsl code:
I just try to do a simple mix-shader: multiply the texture by an amount to make some fades.
but nothing occurs.
here's my glsl code:
- #ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define PROCESSING_TEXTURE_SHADER
uniform sampler2D texture;
uniform float amount;
varying vec4 vertTexCoord;
void main(void) {
vec4 a = texture2D(texture, vertTexCoord.st);
gl_FragColor = a * vec4(amount);}
and here's my pde:
- PShader shade;
PImage img;
float amount;
void setup()
{
size(1200, 800, P3D);
img= loadImage("test.jpg");
shade = loadShader("gain.glsl");
shade.set("texture", img);
shade.set("amount", amount);
}
void draw()
{
background(0);
shader(shade);
amount = map(mouseX, 0, 1200, 0, 1.);
image(img, 0, 0)
}
when I put manual amount in my glsl code it works: gl_FragColor = a * vec4(05);} -the picture is a little bit opaque…
its' as if my amount value doen't go into the glsl code.
thanks in advance
its' as if my amount value doen't go into the glsl code.
thanks in advance