[Bf-blender-cvs] [bbf810f9697] blender2.8: DRW: Fix incorrect blending functions.
Clément Foucault
noreply at git.blender.org
Thu Jan 4 10:53:41 CET 2018
Commit: bbf810f96976692abed26cbde897a1e10f11683e
Author: Clément Foucault
Date: Wed Jan 3 13:25:46 2018 +0100
Branches: blender2.8
https://developer.blender.org/rBbbf810f96976692abed26cbde897a1e10f11683e
DRW: Fix incorrect blending functions.
===================================================================
M source/blender/draw/intern/draw_manager.c
===================================================================
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index ddf8405d67f..c6337367ee1 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1608,7 +1608,8 @@ static void drw_state_set(DRWState state)
glEnable(GL_BLEND);
if ((state & DRW_STATE_BLEND) != 0) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, /* RGB */
+ GL_ONE, GL_ONE_MINUS_SRC_ALPHA); /* Alpha */
}
else if ((state & DRW_STATE_MULTIPLY) != 0) {
glBlendFunc(GL_DST_COLOR, GL_ZERO);
@@ -1617,7 +1618,9 @@ static void drw_state_set(DRWState state)
glBlendFunc(GL_ONE, GL_SRC_ALPHA);
}
else if ((state & DRW_STATE_ADDITIVE) != 0) {
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ /* Do not let alpha accumulate but premult the source RGB by it. */
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, /* RGB */
+ GL_ZERO, GL_ONE); /* Alpha */
}
else {
BLI_assert(0);
More information about the Bf-blender-cvs
mailing list