From eb72df73408cd0fed31b0251ccaf9cbf65147bd7 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Thu, 3 Oct 2013 18:23:04 -0400 Subject: [PATCH] correctly implements SUBTRACT blend mode --- core/src/processing/opengl/PGraphicsOpenGL.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index c71b4cf7c..6ad53ce7b 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -5690,9 +5690,11 @@ public class PGraphicsOpenGL extends PGraphics { } else if (blendMode == SUBTRACT) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_ADD); + pgl.blendEquation(PGL.FUNC_REVERSE_SUBTRACT); + pgl.blendFunc(PGL.ONE, PGL.SRC_ALPHA); + } else { + PGraphics.showWarning(BLEND_DRIVER_ERROR, "SUBTRACT"); } - pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ZERO); } else if (blendMode == LIGHTEST) { if (blendEqSupported) { @@ -5712,11 +5714,9 @@ public class PGraphicsOpenGL extends PGraphics { } else if (blendMode == DIFFERENCE) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_REVERSE_SUBTRACT); - pgl.blendFunc(PGL.ONE, PGL.ONE); - } else { - PGraphics.showWarning(BLEND_DRIVER_ERROR, "DIFFERENCE"); + pgl.blendEquation(PGL.FUNC_ADD); } + pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ZERO); } else if (blendMode == EXCLUSION) { if (blendEqSupported) {