avoid setting the color for every loop
authorCampbell Barton <ideasman42@gmail.com>
Tue, 19 Jul 2011 00:06:43 +0000 (00:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 19 Jul 2011 00:06:43 +0000 (00:06 +0000)
source/blender/blenkernel/intern/cdderivedmesh.c

index d0ea14bc18cb224354347d95d5a3f5a0a6577bcc..edad8ee0dac7c8b7cd20e773bb465f541140c94a 100644 (file)
@@ -275,14 +275,23 @@ static void cdDM_drawSelectedVerts(DerivedMesh *dm)
        MVert *mv = cddm->mvert;
        int i;
        if( GPU_buffer_legacy(dm) ) {
+               char prev_sel= 0; /* always invalid */;
+
                glBegin(GL_POINTS);
                for(i = 0; i < dm->numVertData; i++, mv++) {
-                       if((mv->flag & 1)) {//TODO define selected
-                               glColor3f(1.0f, 1.0f, 0.0f);
-                       }else {
-                               glColor3f(0.0f, 0.0f, 0.0f);
-                       }
                        if(!(mv->flag & ME_HIDE)) {
+                               const char sel= mv->flag & 1;
+                               if(prev_sel != sel) {
+                                       prev_sel= sel;
+
+                                       // TODO define selected color
+                                       if(sel) {
+                                               glColor3f(1.0f, 1.0f, 0.0f);
+                                       }else {
+                                               glColor3f(0.0f, 0.0f, 0.0f);
+                                       }
+                               }
+
                                glVertex3fv(mv->co);
                        }
                }