diff --git a/core/src/processing/core/PGraphicsJava2D.java b/core/src/processing/core/PGraphicsJava2D.java index a687c59442..79c5e30166 100644 --- a/core/src/processing/core/PGraphicsJava2D.java +++ b/core/src/processing/core/PGraphicsJava2D.java @@ -861,7 +861,7 @@ public void compose(Raster src, Raster dstIn, WritableRaster dstOut) { src.getDataElements(0, y, width, 1, srcPixels); dstIn.getDataElements(0, y, width, 1, dstPixels); for (int x = 0; x < width; x++) { - dstPixels[x] = blendColor(srcPixels[x], alphaFiller | dstPixels[x], mode); + dstPixels[x] = blendColor(alphaFiller | dstPixels[x], srcPixels[x], mode); } dstOut.setDataElements(0, y, width, 1, dstPixels); } diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 72d7dff476..e685772d33 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -6012,57 +6012,73 @@ protected void blendModeImpl() { } else if (blendMode == BLEND) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_ADD); + pgl.blendEquationSeparate(PGL.FUNC_ADD, + PGL.FUNC_ADD); } - pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA); + pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA, + PGL.ONE, PGL.ONE); } else if (blendMode == ADD) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_ADD); + pgl.blendEquationSeparate(PGL.FUNC_ADD, + PGL.FUNC_ADD); } - pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE); + pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE, + PGL.ONE, PGL.ONE); } else if (blendMode == SUBTRACT) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_REVERSE_SUBTRACT); - pgl.blendFunc(PGL.ONE, PGL.SRC_ALPHA); + pgl.blendEquationSeparate(PGL.FUNC_REVERSE_SUBTRACT, + PGL.FUNC_ADD); + pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE, + PGL.ONE, PGL.ONE); } else { PGraphics.showWarning(BLEND_DRIVER_ERROR, "SUBTRACT"); } } else if (blendMode == LIGHTEST) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_MAX); - pgl.blendFunc(PGL.SRC_ALPHA, PGL.DST_ALPHA); + pgl.blendEquationSeparate(PGL.FUNC_MAX, + PGL.FUNC_ADD); + pgl.blendFuncSeparate(PGL.ONE, PGL.ONE, + PGL.ONE, PGL.ONE); } else { PGraphics.showWarning(BLEND_DRIVER_ERROR, "LIGHTEST"); } } else if (blendMode == DARKEST) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_MIN); - pgl.blendFunc(PGL.SRC_ALPHA, PGL.DST_ALPHA); + pgl.blendEquationSeparate(PGL.FUNC_MIN, + PGL.FUNC_ADD); + pgl.blendFuncSeparate(PGL.ONE, PGL.ONE, + PGL.ONE, PGL.ONE); } else { PGraphics.showWarning(BLEND_DRIVER_ERROR, "DARKEST"); } } else if (blendMode == EXCLUSION) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_ADD); + pgl.blendEquationSeparate(PGL.FUNC_ADD, + PGL.FUNC_ADD); } - pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ONE_MINUS_SRC_COLOR); + pgl.blendFuncSeparate(PGL.ONE_MINUS_DST_COLOR, PGL.ONE_MINUS_SRC_COLOR, + PGL.ONE, PGL.ONE); } else if (blendMode == MULTIPLY) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_ADD); + pgl.blendEquationSeparate(PGL.FUNC_ADD, + PGL.FUNC_ADD); } - pgl.blendFunc(PGL.DST_COLOR, PGL.SRC_COLOR); + pgl.blendFuncSeparate(PGL.ZERO, PGL.SRC_COLOR, + PGL.ONE, PGL.ONE); } else if (blendMode == SCREEN) { if (blendEqSupported) { - pgl.blendEquation(PGL.FUNC_ADD); + pgl.blendEquationSeparate(PGL.FUNC_ADD, + PGL.FUNC_ADD); } - pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ONE); + pgl.blendFuncSeparate(PGL.ONE_MINUS_DST_COLOR, PGL.ONE, + PGL.ONE, PGL.ONE); } else if (blendMode == DIFFERENCE) { PGraphics.showWarning(BLEND_RENDERER_ERROR, "DIFFERENCE");