-> Alpha Clip Tweak
authorGeoffrey Bantle <hairbat@yahoo.com>
Sat, 22 Dec 2007 12:05:27 +0000 (12:05 +0000)
committerGeoffrey Bantle <hairbat@yahoo.com>
Sat, 22 Dec 2007 12:05:27 +0000 (12:05 +0000)
Apparently on some cards/drivers setting alpha clip to 1.0 will make every
pixel get clipped out regardless of its associated alpha value being 1.0.
Added a fix for this.

source/blender/src/drawmesh.c

index 3c98888ead92c695562fb5271ce5108ba7e409ed..df5334dd27d429707df499cbb48f9bcab45133e4 100644 (file)
@@ -241,9 +241,13 @@ int set_tpage(MTFace *tface)
                                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
                                
                                /* added after 2.45 to clip alpha */
-                               glEnable ( GL_ALPHA_TEST );
-                               glAlphaFunc ( GL_GREATER, U.glalphaclip );
                                
+                               /*if U.glalphaclip == 1.0, some cards go bonkers... turn off alpha test in this case*/
+                               if(U.glalphaclip == 1.0) glDisable(GL_ALPHA_TEST);
+                               else{
+                                       glEnable ( GL_ALPHA_TEST );
+                                       glAlphaFunc ( GL_GREATER, U.glalphaclip );
+                               }
                                
                        /*      glBlendEquationEXT(GL_FUNC_ADD_EXT); */
                        }