fix for editmode opengl drawing (bug from own recent optimization), need to set glSha...
authorCampbell Barton <ideasman42@gmail.com>
Sun, 9 Oct 2011 23:04:31 +0000 (23:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 9 Oct 2011 23:04:31 +0000 (23:04 +0000)
source/blender/blenkernel/intern/DerivedMesh.c

index 6b9a65ddfa2238b16ac60833adbe1943579ac5ad..e46ea1bbe38cc2f56236f05435cf1b543aff0a11 100644 (file)
@@ -697,9 +697,11 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
                                else {
                                        const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
                                        if (shade_type != shade_prev) {
-                                               glShadeModel((shade_prev= shade_type));
+                                               if(poly_prev != GL_ZERO) glEnd();
+                                               glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
+                                               glBegin((poly_prev= poly_type));
                                        }
-                                       if(poly_type != poly_prev) {
+                                       else if(poly_type != poly_prev) {
                                                if(poly_prev != GL_ZERO) glEnd();
                                                glBegin((poly_prev= poly_type));
                                        }
@@ -762,9 +764,11 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
                                else {
                                        const GLenum shade_type= drawSmooth ? GL_SMOOTH : GL_FLAT;
                                        if (shade_type != shade_prev) {
-                                               glShadeModel((shade_prev= shade_type));
+                                               if(poly_prev != GL_ZERO) glEnd();
+                                               glShadeModel((shade_prev= shade_type)); /* same as below but switch shading */
+                                               glBegin((poly_prev= poly_type));
                                        }
-                                       if(poly_type != poly_prev) {
+                                       else if(poly_type != poly_prev) {
                                                if(poly_prev != GL_ZERO) glEnd();
                                                glBegin((poly_prev= poly_type));
                                        }