-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Using filter(PShader) will bug blending mode #5616
Copy link
Copy link
Closed
Labels
Description
Description
I'm trying to postprocess my screenbuffer with a basic vignette fragment shader.
I load the shader, then use filter(), the very first frame is perfect, but the other one is just blended wrong ignoring the transparency values.
Expected Behavior
image() callbacks will blend properly after filter(PShader) callbacks.
Very first frame drawn;
Current Behavior
image() renders images ignoring the transparency values
Frames after the first frame drawn;
Steps to Reproduce
- Load following
vignette.fshshader;
#ifdef GL_ES
precision mediump float;
precision mediump int;
#endif
#define PROCESSING_TEXTURE_SHADER
uniform sampler2D texture;
uniform vec2 resolution;
varying vec4 vertColor;
varying vec4 vertTexCoord;
void main() {
vec4 texColor = texture2D(texture, vertTexCoord.xy);
vec2 position = (gl_FragCoord.xy / resolution.xy) - vec2(0.5);
float len = length(position);
gl_FragColor = vec4( texColor.rgb*(1.0-len), 1.0 );
}- Execute given
draw()method body;
public void render() {
background(255);
image(someTransImg);
filter(vignetteShader);
}- See it will draw transparency right only for the first frame. (use
frameRate(1)@setup()to see easier)
Your Environment
- Processing version: 3.4 (Stable)
- Operating System and OS version: Windows 7 Home Premium
Possible Causes / Solutions
I believe filter(PShader) somehow changes the blending mode into MIX mode.
Also calling blendMode(BLEND) right after filter(PShader) solves it. But that shouldn't be an intended behavior
Reactions are currently unavailable

