blendMode()
RenderingDescription
Blends the pixels in the display window with the pixels underneath using a defined blend mode.
Syntax
void blendMode(int mode)
Parameters
| Name | Type | Description |
|---|---|---|
| mode | int | BLEND, ADD, SUBTRACT, MULTIPLY, SCREEN, DARKEST, LIGHTEST, DIFFERENCE, EXCLUSION |
Returns
voidUnder the Hood
From Processing.h:
void blendMode(int mode);
Under the Hood
From Processing.cpp:
void PApplet::blendMode(int mode) {
glEnable(GL_BLEND);
// Reset equation first (SUBTRACT changes it)
glBlendEquation(GL_FUNC_ADD);
switch (mode) {
case ADD: glBlendFunc(GL_SRC_ALPHA, GL_ONE); break;
case MULTIPLY: glBlendFunc(GL_DST_COLOR, GL_ZERO); break;
case SCREEN: glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_COLOR); break;
case SUBTRACT:
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
break;
default: glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); break;
}
}