From 2acea6287c3da360fa3ddb8cf1b9ba74d2de793d Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 31 Jul 2014 10:46:57 -0400 Subject: [PATCH] set alpha channel to opaque after blitting the multisampled FBO, which fixes #2679 --- core/src/processing/opengl/PGraphicsOpenGL.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index c2bf327e9..bd463b52f 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -6440,19 +6440,22 @@ public class PGraphicsOpenGL extends PGraphics { protected void endOffscreenDraw() { + if (offscreenMultisample) { + multisampleFramebuffer.copyColor(offscreenFramebuffer); + } + + popFramebuffer(); + if (backgroundA == 1) { - // Set alpha channel to opaque in order to match behavior of JAVA2D: + // Set alpha channel to opaque in order to match behavior of JAVA2D, not + // on the multisampled FBO because it leads to wrong background color + // on some Macbooks with AMD graphics. pgl.colorMask(false, false, false, true); pgl.clearColor(0, 0, 0, backgroundA); pgl.clear(PGL.COLOR_BUFFER_BIT); pgl.colorMask(true, true, true, true); } - if (offscreenMultisample) { - multisampleFramebuffer.copyColor(offscreenFramebuffer); - } - - popFramebuffer(); texture.updateTexels(); // Mark all texels in screen texture as modified. getPrimaryPG().restoreGL();