OpenGL: call glLineWidth less often
authorMike Erwin <significant.bit@gmail.com>
Sat, 23 Jan 2016 05:58:32 +0000 (00:58 -0500)
committerMike Erwin <significant.bit@gmail.com>
Sat, 23 Jan 2016 05:58:51 +0000 (00:58 -0500)
Each LINES draw call is now responsible for its own line width. No need
to set it back to its 1.0 default after every draw.

This eliminates half our calls to glLineWidth , similar to last week’s
work on glPointSize.

25 files changed:
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_draw.c
source/blender/editors/armature/reeb.c
source/blender/editors/gpencil/drawgpencil.c
source/blender/editors/interface/interface_draw.c
source/blender/editors/interface/interface_icons.c
source/blender/editors/interface/interface_panel.c
source/blender/editors/mask/mask_draw.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/sculpt_paint/paint_cursor.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_graph_draw.c
source/blender/editors/space_clip/clip_utils.c
source/blender/editors/space_graph/graph_draw.c
source/blender/editors/space_graph/space_graph.c
source/blender/editors/space_node/drawnode.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_view3d/drawarmature.c
source/blender/editors/space_view3d/drawobject.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/transform/transform.c
source/blender/editors/uvedit/uvedit_draw.c

index 656c403e54231d8a47341709251a8fbc986edef7..44765e82ab50c3e3f3050bffb97e318146a8a84b 100644 (file)
@@ -3697,7 +3697,6 @@ static void navmesh_drawColored(DerivedMesh *dm)
        //UI_ThemeColor(TH_WIRE);
        glLineWidth(2.0);
        dm->drawEdges(dm, 0, 1);
-       glLineWidth(1.0);
 #endif
 
        /* if (GPU_buffer_legacy(dm) ) */ /* TODO - VBO draw code, not high priority - campbell */
index 6979850c21af7a6baaca03b5656b3aa611325003..c6a47b96feab97b40d06956ec641f59f7d0c979a 100644 (file)
@@ -3716,7 +3716,6 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
                        glLineWidth(2.0);
                        fdrawline((float)(offset), yminc,
                                  (float)(v2d->cur.xmax), yminc);
-                       glLineWidth(1.0);
                }
        }
 
index 76a448a581ea7cb479c1e7ba339eda350edb91b0..dbc9c8b4f23b13c37c9770728fd091994f50d60e 100644 (file)
@@ -123,9 +123,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
        glVertex2f(x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
        glVertex2f(x, v2d->cur.ymax);
        glEnd();
-       
-       glLineWidth(1.0);
-       
+
        /* Draw current frame number in a little box */
        if (flag & DRAWCFRA_SHOW_NUMBOX) {
                UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
index 2d58689c8beb8d2d49fd5b6fa5489ef920083657..661a8e1de9f8486949cdeaf688741a91c4a7bec3 100644 (file)
@@ -3430,8 +3430,6 @@ void REEB_draw()
                }
        }
        glEnable(GL_DEPTH_TEST);
-       
-       glLineWidth(1.0);
 }
 
 #endif
index d5c7c523ca843fda4afe63d862281f5256459955..66d862854705bccf80ac875452be6fd5690c1515 100644 (file)
@@ -145,9 +145,6 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
                                glVertex2iv(&pt->x);
                }
                glEnd();
-               
-               /* reset for predictable OpenGL context */
-               glLineWidth(1.0f);
 
                if (G.debug & G_DEBUG) setlinestyle(0);
        }
@@ -1122,7 +1119,6 @@ static void gp_draw_data(bGPdata *gpd, int offsx, int offsy, int winx, int winy,
        glDisable(GL_LINE_SMOOTH); // smooth lines
        
        /* restore initial gl conditions */
-       glLineWidth(1.0);
        glColor4f(0, 0, 0, 1);
 }
 
index f044c70f5692f6cf07c712332219f682f3f3505a..260390286d71b700e0ffcdf6523de7e8171646d3 100644 (file)
@@ -528,8 +528,6 @@ static void histogram_draw_one(
                        glVertex2f(x2, y + (data[i] * h));
                }
                glEnd();
-
-               glLineWidth(1.0);
        }
        else {
                /* under the curve */
@@ -1631,7 +1629,7 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol
        glEnd();
        
        glColor4ub(0, 0, 0, 150);
-       
+       glLineWidth(1);
        glEnable(GL_LINE_SMOOTH);
        glBegin(GL_LINE_LOOP);
        for (int a = 0; a < 16; a++)
index 8e6558c74b892f0548d3edb523854d272efe1159..da0e14574e5b24e306ff2166e5e0778f8f09ccd1 100644 (file)
@@ -274,8 +274,6 @@ static void vicon_x_draw(int x, int y, int w, int h, float alpha)
        glVertex2i(x + w, y);
        glVertex2i(x, y + h);
        glEnd();
-
-       glLineWidth(1.0);
        
        glDisable(GL_LINE_SMOOTH);
 }
@@ -443,7 +441,6 @@ static void vicon_move_up_draw(int x, int y, int w, int h, float UNUSED(alpha))
        glVertex2i(x + w / 2 + d * 2, y + h / 2 + d);
        glEnd();
 
-       glLineWidth(1.0);
        glDisable(GL_LINE_SMOOTH);
 }
 
@@ -461,7 +458,6 @@ static void vicon_move_down_draw(int x, int y, int w, int h, float UNUSED(alpha)
        glVertex2i(x + w / 2 + d * 2, y + h / 2 + d);
        glEnd();
 
-       glLineWidth(1.0);
        glDisable(GL_LINE_SMOOTH);
 }
 
index f5dc85c1ea7d411ba40146f527d61b35c7d9452e..f59f11c0da01969a15b23485d00eb9a587ff3d86 100644 (file)
@@ -452,8 +452,6 @@ static void ui_draw_anti_x(float x1, float y1, float x2, float y2)
        fdrawline(x1, y1, x2, y2);
        fdrawline(x1, y2, x2, y1);
        
-       glLineWidth(1.0);
-       
        glDisable(GL_LINE_SMOOTH);
        glDisable(GL_BLEND);
        
index 74af0aaffcedb99c49ecca8c23b0fc89c09c3068..9a8382b21364431fdcd572c7e9a1be93348d29a5 100644 (file)
@@ -197,7 +197,6 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
                glVertex2fv(point_pos);
                glVertex2fv(handle_pos);
                glEnd();
-               glLineWidth(1);
        }
 
        switch (handle_type) {
@@ -213,6 +212,7 @@ static void draw_single_handle(const MaskLayer *mask_layer, const MaskSplinePoin
                        break;
        }
 
+       glLineWidth(1);
        glBegin(GL_LINES);
        glVertex2fv(point_pos);
        glVertex2fv(handle_pos);
index 89d3cf7db059809fa8c278ceb9742f4e412144a4..b606eb0f8d623802ab9c7785fd516fdd6ee295d2 100644 (file)
@@ -1050,8 +1050,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                glVertex3fv(kcd->prev.cage);
                glVertex3fv(kcd->curr.cage);
                glEnd();
-
-               glLineWidth(1.0);
        }
 
        if (kcd->prev.vert) {
@@ -1080,8 +1078,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                glVertex3fv(kcd->curr.edge->v1->cageco);
                glVertex3fv(kcd->curr.edge->v2->cageco);
                glEnd();
-
-               glLineWidth(1.0);
        }
        else if (kcd->curr.vert) {
                glColor3ubv(kcd->colors.point);
@@ -1151,7 +1147,6 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg)
                }
 
                glEnd();
-               glLineWidth(1.0);
        }
 
        if (kcd->totkvert > 0) {
index 461cdb29b8413b6c7db9089b230f22bac92909aa..8e969e096d399bab42e6578d600a0f82302c0738 100644 (file)
@@ -1045,11 +1045,11 @@ static void drawscredge_area(ScrArea *sa, int sizex, int sizey, int center)
                        glColor3ub(0x50, 0x50, 0x50);
                        glLineWidth((2.0f * U.pixelsize) - 1);
                        drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
-                       glLineWidth(1.0f);
                }
        }
        else {
                glColor3ub(0, 0, 0);
+               glLineWidth(1);
                drawscredge_area_draw(sizex, sizey, x1, y1, x2, y2, 0);
        }
 }
index aad9df1a9784db9c5894c47f94f3a013947991ff..2f4dc549694e7c8f4618eef476e86bcb73ca4a43 100644 (file)
@@ -932,8 +932,6 @@ static void paint_draw_curve_cursor(Brush *brush)
                draw_rect_point(&cp->bez.vec[0][0], 8.0, cp->bez.f1 || cp->bez.f2);
                draw_rect_point(&cp->bez.vec[2][0], 8.0, cp->bez.f3 || cp->bez.f2);
 
-               glLineWidth(1.0);
-
                glDisable(GL_BLEND);
                glDisable(GL_LINE_SMOOTH);
                glDisableClientState(GL_VERTEX_ARRAY);
index 49e5e2646593d24c9593f55d3f14e03d02d2aaf2..7f1a4212ce417d17221cd0a821e3c0e01786f69d 100644 (file)
@@ -727,7 +727,6 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda
                glLineWidth(2.0);
                glColor4ub(255, 255, 255, 255);
                sdrawline(x, y, pop->startmouse[0], pop->startmouse[1]);
-               glLineWidth(1.0);
 
                glDisable(GL_BLEND);
                glDisable(GL_LINE_SMOOTH);
index a4dc71dfb8394fa68d23627ec969d3ae5932978a..6542a4d1c0c413e31951067802ef3e3acd7570ad 100644 (file)
@@ -439,7 +439,6 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
                for (i = a; i < b; i++)
                        glVertex2f(path[i][0], path[i][1]);
                glEnd();
-               glLineWidth(1.0f);
        }
 
        UI_ThemeColor(TH_PATH_BEFORE);
@@ -459,6 +458,8 @@ static void draw_track_path(SpaceClip *sc, MovieClip *UNUSED(clip), MovieTrackin
 
        UI_ThemeColor(TH_PATH_BEFORE);
 
+       glLineWidth(1);
+
        glBegin(GL_LINE_STRIP);
        for (i = a; i < b; i++) {
                if (i == count + 1)
@@ -515,7 +516,6 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
                        glVertex2f(pos[0], pos[1] + px[1] * 2);
                        glVertex2f(pos[0], pos[1] + px[1] * 8);
                        glEnd();
-                       if (!tiny) glLineWidth(1.0f);
                }
        }
 
@@ -543,9 +543,6 @@ static void draw_marker_outline(SpaceClip *sc, MovieTrackingTrack *track, MovieT
                glEnd();
        }
        glPopMatrix();
-
-       if (!tiny)
-               glLineWidth(1.0f);
 }
 
 static void track_colors(MovieTrackingTrack *track, int act, float col[3], float scol[3])
@@ -886,9 +883,6 @@ static void draw_marker_slide_zones(SpaceClip *sc, MovieTrackingTrack *track, Mo
        }
 
        glPopMatrix();
-
-       if (outline)
-               glLineWidth(1.0f);
 }
 
 static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTrackingMarker *marker,
@@ -1192,9 +1186,6 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane
 
                if (stipple)
                        glDisable(GL_LINE_STIPPLE);
-               
-               if (thick)
-                       glLineWidth(1.0f);
        }
 
        /* Draw sliders. */
@@ -1663,8 +1654,6 @@ static void draw_distortion(SpaceClip *sc, ARegion *ar, MovieClip *clip,
 
                        layer = layer->next;
                }
-
-               glLineWidth(1.0f);
        }
 
        glPopMatrix();
index 2c3b8acf672a2860bc92fc23e1188a9296de44e4..424d25defdde0b620882d24a2e6267ee590f3abc 100644 (file)
@@ -115,8 +115,6 @@ static void tracking_segment_start_cb(void *userdata, MovieTrackingTrack *track,
 static void tracking_segment_end_cb(void *UNUSED(userdata), int UNUSED(coord))
 {
        glEnd();
-
-       glLineWidth(1.0f);
 }
 
 typedef struct TrackMotionCurveUserData {
@@ -261,7 +259,6 @@ static void tracking_error_segment_end_cb(void *UNUSED(userdata), int coord)
 {
        if (coord == 1) {
                glEnd();
-               glLineWidth(1.0f);
        }
 }
 
index 034429f6992e0a7f091dc4ec3f52edbdb8f316eb..5964e9a898b545e8504bbcff5041d496a70be262 100644 (file)
@@ -260,8 +260,6 @@ void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
        glVertex2f(x, v2d->cur.ymax);
        glEnd();
 
-       glLineWidth(1.0);
-
        UI_view2d_view_orthoSpecial(ar, v2d, 1);
 
        /* because the frame number text is subject to the same scaling as the contents of the view */
index b5b308f1b83b7ea6fbf7346539eaee13c06f8a31..c441bdd581361ad754df26a2d846d5f59fcaf48f 100644 (file)
@@ -85,6 +85,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
        
        /* draw two black lines showing the standard reference levels */
        glColor3f(0.0f, 0.0f, 0.0f);
+       glLineWidth(1);
        setlinestyle(5);
        
        glBegin(GL_LINES);
@@ -93,7 +94,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d)
                
        glVertex2f(v2d->cur.xmin, env->midval + env->max);
        glVertex2f(v2d->cur.xmax, env->midval + env->max);
-       glEnd();  /* GL_LINES */
+       glEnd();
        setlinestyle(0);
        
        /* set size of vertices (non-adjustable for now) */
@@ -852,7 +853,6 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu)
                
                /* cleanup line drawing */
                setlinestyle(0);
-               glLineWidth(1.0f);
        }
        
        /* draw driver only if actually functional */
@@ -946,7 +946,6 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar)
        
        /* restore settings */
        setlinestyle(0);
-       glLineWidth(1.0f);
        
        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
        glDisable(GL_BLEND);
@@ -1036,7 +1035,6 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid
                        
                        /* restore settings */
                        setlinestyle(0);
-                       glLineWidth(1.0);
                        
                        if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) glDisable(GL_LINE_SMOOTH);
                        glDisable(GL_BLEND);
index 6d040546929f0ba918340ab05edf5a9bde8e7cd1..c6a8a9753d13a5430e39f0a0761c746a5ce535d8 100644 (file)
@@ -280,7 +280,6 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
                glVertex2f(v2d->cur.xmax, y);
                glEnd();
 
-               glLineWidth(1.0);
                glDisable(GL_BLEND);
        }
        
@@ -299,7 +298,6 @@ static void graph_main_region_draw(const bContext *C, ARegion *ar)
                glVertex2f(x, v2d->cur.ymax);
                glEnd();
 
-               glLineWidth(1.0);
                glDisable(GL_BLEND);
        }
        else {
index fefb433d0eb23ade86c03d5f86fc8d5f49870fcf..a130436770a84220974babb5489c222c84a98c0f 100644 (file)
@@ -3506,9 +3506,6 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link,
                }
                
                glDisable(GL_LINE_SMOOTH);
-               
-               /* restore previuos linewidth */
-               glLineWidth(1.0f);
        }
 }
 
@@ -3588,9 +3585,6 @@ void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link,
        }
        
        glDisable(GL_LINE_SMOOTH);
-       
-       /* restore previuos linewidth */
-       glLineWidth(1.0f);
 }
 #endif
 
index b4ab516ed5c810b3e8576c874341c3655343c54e..9c02acb3683b1dc5501761274130977d59b9d9e2 100644 (file)
@@ -651,7 +651,6 @@ static void node_circle_draw(float x, float y, float size, const float col[4], i
        glEnd();
        glDisable(GL_LINE_SMOOTH);
        glDisable(GL_BLEND);
-       glLineWidth(1.0f);
 }
 
 void node_socket_circle_draw(const bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *sock, float size, int highlight)
index 6a3e8f242befd1d8c9e8fd6bb65217c02d316f64..cf77a79c92cb6c8e1f4a6cd06be8ef09bfc8f295 100644 (file)
@@ -1090,8 +1090,6 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
                glBitmap(8, 8, 4, 4, 0, 0, bm_dot5);
        }
        
-       glLineWidth(1.0);
-       
        glPopMatrix();
 }
 
index 3f29f7772b9bf8c6953588e336eac1df457621c8..29f0ff2425eca8ca1cc753dc85a5f24c3cd42841 100644 (file)
@@ -492,7 +492,9 @@ void drawaxes(float size, char drawtype)
        float v1[3] = {0.0, 0.0, 0.0};
        float v2[3] = {0.0, 0.0, 0.0};
        float v3[3] = {0.0, 0.0, 0.0};
-       
+
+       glLineWidth(1);
+
        switch (drawtype) {
 
                case OB_PLAINAXES:
@@ -749,6 +751,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *rv3d, const float co[3],
        glDrawArrays(GL_POLYGON, 0, CIRCLE_RESOL);
 
        /* 2. draw outline */
+       glLineWidth(1);
        UI_ThemeColorShadeAlpha(TH_WIRE, 0, -30);
        glDrawArrays(GL_LINE_LOOP, 0, CIRCLE_RESOL);
 
@@ -1203,6 +1206,8 @@ static void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
                glColor4ubv(curcol);
        }
 
+       glLineWidth(1);
+
        if (lampsize > 0.0f) {
 
                if ((dflag & DRAW_CONSTCOLOR) == 0) {
@@ -1661,7 +1666,6 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
                                        draw_bundle_sphere();
 
                                        glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-                                       glLineWidth(1.0f);
                                }
 
                                if ((dflag & DRAW_CONSTCOLOR) == 0) {
@@ -1717,8 +1721,6 @@ static void draw_viewport_object_reconstruction(Scene *scene, Base *base, View3D
                                        glVertex3fv(camera->mat[3]);
                                }
                                glEnd();
-
-                               glLineWidth(1.0f);
                        }
                }
        }
@@ -2062,6 +2064,7 @@ static void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base
                                 asp, shift, &drawsize, vec);
 
        glDisable(GL_CULL_FACE);
+       glLineWidth(1);
 
        /* camera frame */
        if (!is_stereo3d_cameras) {
@@ -2163,6 +2166,7 @@ static void drawspeaker(Scene *UNUSED(scene), View3D *UNUSED(v3d), RegionView3D
        float vec[3];
 
        glEnable(GL_BLEND);
+       glLineWidth(1);
 
        for (int j = 0; j < 3; j++) {
                vec[2] = 0.25f * j - 0.125f;
@@ -2317,7 +2321,8 @@ static void drawlattice(View3D *v3d, Object *ob)
                        glShadeModel(GL_SMOOTH);
                }
        }
-       
+
+       glLineWidth(1);
        glBegin(GL_LINES);
        for (w = 0; w < lt->pntsw; w++) {
                int wxt = (w == 0 || w == lt->pntsw - 1);
@@ -3041,7 +3046,6 @@ static void draw_dm_creases(BMEditMesh *em, DerivedMesh *dm)
        if (data.cd_layer_offset != -1) {
                glLineWidth(3.0);
                dm->drawMappedEdges(dm, draw_dm_creases__setDrawOptions, &data);
-               glLineWidth(1.0);
        }
 }
 
@@ -3101,7 +3105,6 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
                if (data.cd_layer_offset != -1) {
                        glLineWidth(3.0);
                        dm->drawMappedEdges(dm, draw_dm_bweights__setDrawOptions, &data);
-                       glLineWidth(1.0);
                }
        }
 }
@@ -3657,6 +3660,8 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
        BMVert *eve_act = NULL;
        bool use_occlude_wire = (v3d->flag2 & V3D_OCCLUDE_WIRE) && (dt > OB_WIRE);
        
+       glLineWidth(1);
+
        if (em->bm->selected.last) {
                BMEditSelection *ese = em->bm->selected.last;
                /* face is handled above */
@@ -3809,7 +3814,6 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                        draw_dm_edges_seams(em, cageDM);
 
                        glColor3ub(0, 0, 0);
-                       glLineWidth(1);
                }
                
                if (me->drawflag & ME_DRAWSHARP) {
@@ -3819,7 +3823,6 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                        draw_dm_edges_sharp(em, cageDM);
 
                        glColor3ub(0, 0, 0);
-                       glLineWidth(1);
                }
 
 #ifdef WITH_FREESTYLE
@@ -3830,7 +3833,6 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                        draw_dm_edges_freestyle(em, cageDM);
        
                        glColor3ub(0, 0, 0);
-                       glLineWidth(1);
                }
 #endif
        
@@ -3841,6 +3843,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,
                        draw_dm_bweights(em, scene, cageDM);
                }
 
+               glLineWidth(1);
                draw_em_fancy_edges(em, scene, v3d, me, cageDM, 0, eed_act);
        }
 
@@ -3910,7 +3913,6 @@ static void draw_mesh_object_outline(View3D *v3d, Object *ob, DerivedMesh *dm)
                        dm->drawEdges(dm, 0, 1);
                }
 
-               glLineWidth(1.0);
                glDepthMask(1);
        }
 }
@@ -5541,8 +5543,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
                        cdata2 = NULL;
                }
 
-               glLineWidth(1.0f);
-
                if ((part->draw & PART_DRAW_NUM) && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
                        cache = psys->pathcache;
 
@@ -5820,7 +5820,6 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
        glDisableClientState(GL_VERTEX_ARRAY);
        glShadeModel(GL_FLAT);
        if (v3d->zbuf) glEnable(GL_DEPTH_TEST);
-       glLineWidth(1.0f);
 }
 
 static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, float ith, float drw_size)
@@ -6072,7 +6071,6 @@ static void drawhandlesN_active(Nurb *nu)
        glEnd();
 
        glColor3ub(0, 0, 0);
-       glLineWidth(1);
 }
 
 static void drawvertsN(Nurb *nu, const char sel, const bool hide_handles, const void *vert)
@@ -6155,7 +6153,6 @@ static void editnurb_draw_active_poly(Nurb *nu)
        }
 
        glColor3ub(0, 0, 0);
-       glLineWidth(1);
 }
 
 static void editnurb_draw_active_nurbs(Nurb *nu)
@@ -6197,7 +6194,6 @@ static void editnurb_draw_active_nurbs(Nurb *nu)
        glEnd();
 
        glColor3ub(0, 0, 0);
-       glLineWidth(1);
 }
 
 static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
@@ -7178,7 +7174,6 @@ static void drawObjectSelect(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
                        draw_armature(scene, v3d, ar, base, OB_WIRE, 0, ob_wire_col, true);
        }
 
-       glLineWidth(1.0);
        glDepthMask(1);
 }
 
@@ -7195,6 +7190,7 @@ static void draw_wire_extra(Scene *scene, RegionView3D *rv3d, Object *ob, const
 
                ED_view3d_polygon_offset(rv3d, 1.0);
                glDepthMask(0);  /* disable write in zbuffer, selected edge wires show better */
+               glLineWidth(1);
 
                if (ELEM(ob->type, OB_FONT, OB_CURVE, OB_SURF)) {
                        if (ED_view3d_boundbox_clip(rv3d, ob->bb)) {
@@ -7274,7 +7270,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data,
                        view3d_cached_text_draw_add(v, axis_str[axis], 2, 0, V3D_CACHE_TEXT_ASCII, ob_wire_col);
                }
        }
-       glLineWidth(1.0f);
+
        setlinestyle(0);
 }
 
index c66647e009ea8c49e7be78400914b847831224b5..3803b7b288f059f1867a0ce650f7146f90536606 100644 (file)
@@ -490,6 +490,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
 
        UI_GetThemeColor3ubv(TH_GRID, col_grid);
 
+       glLineWidth(1);
+
        /* draw the Y axis and/or grid lines */
        if (v3d->gridflag & V3D_SHOW_FLOOR) {
                const int sublines = v3d->gridsubdiv;
@@ -569,6 +571,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
                const float f10 = 0.5f * U.widget_unit;
                const float f20 = U.widget_unit;
                
+               glLineWidth(1);
                setlinestyle(0); 
                cpack(0xFF);
                circ((float)co[0], (float)co[1], f10);
@@ -636,9 +639,6 @@ static void draw_view_axis(RegionView3D *rv3d, rcti *rect)
                glEnable(GL_BLEND);
        }
 
-       /* restore line-width */
-       
-       glLineWidth(1.0);
        glDisable(GL_BLEND);
 }
 
index 89313d3dc284174b877730fa925615bb0bdef546..f9d13eefc09bb9d1fb80d043ce48f2c82e2bdc34 100644 (file)
@@ -1711,6 +1711,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
                                UI_ThemeColor(TH_VIEW_OVERLAY);
 
                                setlinestyle(3);
+                               glLineWidth(1);
                                glBegin(GL_LINES);
                                glVertex2iv(t->mval);
                                glVertex2fv(cent);
@@ -1752,6 +1753,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
                                UI_ThemeColor(TH_VIEW_OVERLAY);
 
                                setlinestyle(3);
+                               glLineWidth(1);
                                glBegin(GL_LINES);
                                glVertex2iv(t->mval);
                                glVertex2fv(cent);
@@ -1804,7 +1806,6 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
                }
 
                glPopMatrix();
-               glLineWidth(1.0);
        }
 }
 
index 988f60a36f907d5b85d2aae229637a69f14149af..baa471e920b48575c0d53729f96145e322a14123 100644 (file)
@@ -738,7 +738,9 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit)
                glEnable(GL_BLEND);
                glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        }
-       
+
+       glLineWidth(1);
+
        switch (sima->dt_uv) {
                case SI_UVDT_DASH:
                        BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {