Skip to content

Commit 13d401e

Browse files
committed
blendMode: add BLEND/DARKEST/LIGHTEST/DIFFERENCE/REPLACE modes
1 parent ed594f5 commit 13d401e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Processing.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2879,13 +2879,21 @@ void PApplet::blendMode(int mode) {
28792879
// Reset equation first (SUBTRACT changes it)
28802880
glBlendEquation(GL_FUNC_ADD);
28812881
switch (mode) {
2882+
case BLEND: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break;
28822883
case ADD: glBlendFunc(GL_SRC_ALPHA, GL_ONE); break;
28832884
case MULTIPLY: glBlendFunc(GL_DST_COLOR, GL_ZERO); break;
28842885
case SCREEN: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); break;
2886+
case DARKEST: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_MIN); break;
2887+
case LIGHTEST: glBlendFunc(GL_ONE, GL_ONE); glBlendEquation(GL_MAX); break;
2888+
case DIFFERENCE:
2889+
glBlendEquation(GL_FUNC_SUBTRACT);
2890+
glBlendFunc(GL_ONE, GL_ONE);
2891+
break;
28852892
case SUBTRACT:
28862893
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
28872894
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
28882895
break;
2896+
case REPLACE: glBlendFunc(GL_ONE, GL_ZERO); break;
28892897
default: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break;
28902898
}
28912899
}

0 commit comments

Comments
 (0)