Commit: 44bbb0f4f96491516d02de2e1e45b0ae2be0bbc4
Author: Campbell Barton
Date:   Thu Jun 9 00:43:26 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB44bbb0f4f96491516d02de2e1e45b0ae2be0bbc4

GPU: fix texface image w/ basic-shader

===================================================================

M       source/blender/editors/space_view3d/drawmesh.c

===================================================================

diff --git a/source/blender/editors/space_view3d/drawmesh.c 
b/source/blender/editors/space_view3d/drawmesh.c
index 86f3edf..883f067 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -369,15 +369,18 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
        }
 
        if (c_badtex) lit = 0;
-       if (lit != c_lit || ma != c_ma) {
-               if (lit) {
-                       int options = GPU_SHADER_LIGHTING | 
GPU_SHADER_USE_COLOR;
+       if (lit != c_lit || ma != c_ma || textured != c_textured) {
+               int options = GPU_SHADER_USE_COLOR;
 
-                       if (gtexdraw.two_sided_lighting)
-                               options |= GPU_SHADER_TWO_SIDED;
-                       if (c_textured && !c_badtex)
-                               options |= GPU_SHADER_TEXTURE_2D;
+               if (c_textured && !c_badtex) {
+                       options |= GPU_SHADER_TEXTURE_2D;
+               }
+               if (gtexdraw.two_sided_lighting) {
+                       options |= GPU_SHADER_TWO_SIDED;
+               }
 
+               if (lit) {
+                       options |= GPU_SHADER_LIGHTING;
                        if (!ma)
                                ma = give_current_material_or_def(NULL, 0);  /* 
default material */
 
@@ -385,12 +388,10 @@ static bool set_draw_settings_cached(int clearcache, 
MTexPoly *texface, Material
                        mul_v3_v3fl(specular, &ma->specr, ma->spec);
 
                        GPU_basic_shader_colors(NULL, specular, ma->har, 1.0f);
-                       GPU_basic_shader_bind(options);
-               }
-               else {
-                       GPU_basic_shader_bind(GPU_SHADER_USE_COLOR);
                }
 
+               GPU_basic_shader_bind(options);
+
                c_lit = lit;
                c_ma = ma;
        }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to