Skip to content

Commit a366d5f

Browse files
committed
porting blend fixes from desktop OpenGL
1 parent d83dddb commit a366d5f

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

+32-16
Original file line numberDiff line numberDiff line change
@@ -6012,57 +6012,73 @@ protected void blendModeImpl() {
60126012

60136013
} else if (blendMode == BLEND) {
60146014
if (blendEqSupported) {
6015-
pgl.blendEquation(PGL.FUNC_ADD);
6015+
pgl.blendEquationSeparate(PGL.FUNC_ADD,
6016+
PGL.FUNC_ADD);
60166017
}
6017-
pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA);
6018+
pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE_MINUS_SRC_ALPHA,
6019+
PGL.ONE, PGL.ONE);
60186020

60196021
} else if (blendMode == ADD) {
60206022
if (blendEqSupported) {
6021-
pgl.blendEquation(PGL.FUNC_ADD);
6023+
pgl.blendEquationSeparate(PGL.FUNC_ADD,
6024+
PGL.FUNC_ADD);
60226025
}
6023-
pgl.blendFunc(PGL.SRC_ALPHA, PGL.ONE);
6026+
pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE,
6027+
PGL.ONE, PGL.ONE);
60246028

60256029
} else if (blendMode == SUBTRACT) {
60266030
if (blendEqSupported) {
6027-
pgl.blendEquation(PGL.FUNC_REVERSE_SUBTRACT);
6028-
pgl.blendFunc(PGL.ONE, PGL.SRC_ALPHA);
6031+
pgl.blendEquationSeparate(PGL.FUNC_REVERSE_SUBTRACT,
6032+
PGL.FUNC_ADD);
6033+
pgl.blendFuncSeparate(PGL.SRC_ALPHA, PGL.ONE,
6034+
PGL.ONE, PGL.ONE);
60296035
} else {
60306036
PGraphics.showWarning(BLEND_DRIVER_ERROR, "SUBTRACT");
60316037
}
60326038

60336039
} else if (blendMode == LIGHTEST) {
60346040
if (blendEqSupported) {
6035-
pgl.blendEquation(PGL.FUNC_MAX);
6036-
pgl.blendFunc(PGL.SRC_ALPHA, PGL.DST_ALPHA);
6041+
pgl.blendEquationSeparate(PGL.FUNC_MAX,
6042+
PGL.FUNC_ADD);
6043+
pgl.blendFuncSeparate(PGL.ONE, PGL.ONE,
6044+
PGL.ONE, PGL.ONE);
60376045
} else {
60386046
PGraphics.showWarning(BLEND_DRIVER_ERROR, "LIGHTEST");
60396047
}
60406048

60416049
} else if (blendMode == DARKEST) {
60426050
if (blendEqSupported) {
6043-
pgl.blendEquation(PGL.FUNC_MIN);
6044-
pgl.blendFunc(PGL.SRC_ALPHA, PGL.DST_ALPHA);
6051+
pgl.blendEquationSeparate(PGL.FUNC_MIN,
6052+
PGL.FUNC_ADD);
6053+
pgl.blendFuncSeparate(PGL.ONE, PGL.ONE,
6054+
PGL.ONE, PGL.ONE);
60456055
} else {
60466056
PGraphics.showWarning(BLEND_DRIVER_ERROR, "DARKEST");
60476057
}
60486058

60496059
} else if (blendMode == EXCLUSION) {
60506060
if (blendEqSupported) {
6051-
pgl.blendEquation(PGL.FUNC_ADD);
6061+
pgl.blendEquationSeparate(PGL.FUNC_ADD,
6062+
PGL.FUNC_ADD);
60526063
}
6053-
pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ONE_MINUS_SRC_COLOR);
6064+
pgl.blendFuncSeparate(PGL.ONE_MINUS_DST_COLOR, PGL.ONE_MINUS_SRC_COLOR,
6065+
PGL.ONE, PGL.ONE);
60546066

60556067
} else if (blendMode == MULTIPLY) {
60566068
if (blendEqSupported) {
6057-
pgl.blendEquation(PGL.FUNC_ADD);
6069+
pgl.blendEquationSeparate(PGL.FUNC_ADD,
6070+
PGL.FUNC_ADD);
60586071
}
6059-
pgl.blendFunc(PGL.DST_COLOR, PGL.SRC_COLOR);
6072+
pgl.blendFuncSeparate(PGL.ZERO, PGL.SRC_COLOR,
6073+
PGL.ONE, PGL.ONE);
60606074

60616075
} else if (blendMode == SCREEN) {
60626076
if (blendEqSupported) {
6063-
pgl.blendEquation(PGL.FUNC_ADD);
6077+
pgl.blendEquationSeparate(PGL.FUNC_ADD,
6078+
PGL.FUNC_ADD);
60646079
}
6065-
pgl.blendFunc(PGL.ONE_MINUS_DST_COLOR, PGL.ONE);
6080+
pgl.blendFuncSeparate(PGL.ONE_MINUS_DST_COLOR, PGL.ONE,
6081+
PGL.ONE, PGL.ONE);
60666082

60676083
} else if (blendMode == DIFFERENCE) {
60686084
PGraphics.showWarning(BLEND_RENDERER_ERROR, "DIFFERENCE");

0 commit comments

Comments
 (0)