[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40803] trunk/blender/source/blender/gpu/ intern/gpu_draw.c: Fix #28766: object properties > display > transparency no longer worked in solid

Brecht Van Lommel brechtvanlommel at pandora.be
Wed Oct 5 17:28:03 CEST 2011


Revision: 40803
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40803
Author:   blendix
Date:     2011-10-05 15:28:02 +0000 (Wed, 05 Oct 2011)
Log Message:
-----------
Fix #28766: object properties > display > transparency no longer worked in solid
draw mode, after texface changes.

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	2011-10-05 15:02:00 UTC (rev 40802)
+++ trunk/blender/source/blender/gpu/intern/gpu_draw.c	2011-10-05 15:28:02 UTC (rev 40803)
@@ -1136,6 +1136,9 @@
 		GMS.lastretval = !GMS.lastretval;
 
 	if(GMS.lastretval) {
+		/* for alpha pass, use alpha blend */
+		alphablend = (GMS.alphapass)? GPU_BLEND_ALPHA: GPU_BLEND_SOLID;
+
 		if(gattribs && GMS.gmatbuf[nr]) {
 			/* bind glsl material and get attributes */
 			Material *mat = GMS.gmatbuf[nr];
@@ -1145,8 +1148,12 @@
 			GPU_material_bind(gpumat, GMS.gob->lay, GMS.glay, 1.0, !(GMS.gob->mode & OB_MODE_TEXTURE_PAINT));
 			GPU_material_bind_uniforms(gpumat, GMS.gob->obmat, GMS.gviewmat, GMS.gviewinv, GMS.gob->col);
 			GMS.gboundmat= mat;
-			alphablend= mat->game.alpha_blend;
 
+			/* for glsl use alpha blend mode, unless it's set to solid and
+			   we are already drawing in an alpha pass */
+			if(mat->game.alpha_blend != GPU_BLEND_SOLID)
+				alphablend= mat->game.alpha_blend;
+
 			if(GMS.alphapass) glDepthMask(1);
 		}
 		else {
@@ -1154,11 +1161,9 @@
 			glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, GMS.matbuf[nr].diff);
 			glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, GMS.matbuf[nr].spec);
 			glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, GMS.matbuf[nr].hard);
-			alphablend= GPU_BLEND_SOLID;
 		}
 
 		/* set (alpha) blending mode */
-		if(!GMS.alphapass) alphablend= GPU_BLEND_SOLID;
 		GPU_set_material_alpha_blend(alphablend);
 	}
 




More information about the Bf-blender-cvs mailing list