diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-18 21:39:44 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-18 21:39:44 +0400 |
commit | 525da1f872a79a212e56f0692472d7831ddaf442 (patch) | |
tree | 717b79d993c580e0ab2f4236403c2ac801c490c2 /source/blender/gpu/intern/gpu_draw.c | |
parent | 9ab3d4ff1eaacb8156043ac33bca7e9ac07806e6 (diff) |
Fix wrong alpha channel for OpenGL render results with transparent textures or
materials, the typical glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); blend
function does not give correct destination alpha.
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 80f35d531cd..c631f7efbe9 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -395,7 +395,12 @@ static void gpu_set_alpha_blend(GPUBlendMode alphablend) } else if (ELEM(alphablend, GPU_BLEND_ALPHA, GPU_BLEND_ALPHA_SORT)) { glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + /* for OpenGL render we use the alpha channel, this makes alpha blend correct */ + if (GLEW_VERSION_1_4) + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + else + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* if U.glalphaclip == 1.0, some cards go bonkers... * turn off alpha test in this case */ |