Shader to fade out
in
Programming Questions
•
4 months ago
I have been trying for days now to make a shader to fade out a PGraphics instance that I draw on top of my other graphics. I have never written a shader until now so I did some reading and looked at many examples. From what I read this should be very simple but I am not succeeding.
Here is my shader.
-
#define PROCESSING_TEXTURE_SHADER
uniform sampler2D texture;varying vec4 vertColor;varying vec4 vertTexCoord;
void main(){// Get the rgba value for the pixelvec4 rgba = texture2D(texture, vertTexCoord.st);
// if it still has some alpha value then reduce itif(rgba.a>0){rgba.a-=.1;}
gl_FragColor = rgba;}
What happens is that the pixels never get totally transparent. Can you guys see what I am doing wrong in my shader?
Best,
Sammi
1