Fix #28766: object properties > display > transparency no longer worked in solid
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 5 Oct 2011 15:28:02 +0000 (15:28 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 5 Oct 2011 15:28:02 +0000 (15:28 +0000)
draw mode, after texface changes.

source/blender/gpu/intern/gpu_draw.c

index 120c203e7bd50f4b19f27b1edb9df46cfd77ce99..c5d625590565f27a6e42556713ef393405ad4497 100644 (file)
@@ -1136,6 +1136,9 @@ int GPU_enable_material(int nr, void *attribs)
                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,7 +1148,11 @@ int GPU_enable_material(int nr, void *attribs)
                        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);
                }
@@ -1154,11 +1161,9 @@ int GPU_enable_material(int nr, void *attribs)
                        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);
        }