diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-01-03 15:25:46 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-01-04 12:43:54 +0300 |
commit | bbf810f96976692abed26cbde897a1e10f11683e (patch) | |
tree | 4a3a83de472a27ffdee8024aa489ebe15dba7c30 /source | |
parent | 2b678db3fe29de58fa690ac8b65e1cf3e914e9df (diff) |
DRW: Fix incorrect blending functions.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 7 |
1 files changed, 5 insertions, 2 deletions
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); |