[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54638] trunk/blender/source/blender/gpu/ intern/gpu_draw.c: Fix wrong alpha channel for OpenGL render results with transparent textures or
Brecht Van Lommel
brechtvanlommel at pandora.be
Mon Feb 18 18:39:44 CET 2013
Revision: 54638
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54638
Author: blendix
Date: 2013-02-18 17:39:44 +0000 (Mon, 18 Feb 2013)
Log Message:
-----------
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.
Modified Paths:
--------------
trunk/blender/source/blender/gpu/intern/gpu_draw.c
Modified: trunk/blender/source/blender/gpu/intern/gpu_draw.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_draw.c 2013-02-18 16:35:13 UTC (rev 54637)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c 2013-02-18 17:39:44 UTC (rev 54638)
@@ -395,7 +395,12 @@
}
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 */
More information about the Bf-blender-cvs
mailing list