diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-01-22 09:45:39 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-01-22 10:52:12 +0300 |
commit | 66d9efe765626887a911cd0415681bbd4b21c89c (patch) | |
tree | 56b7867b69757192966aadab66024b61ee948011 /source/blender/editors/space_view3d | |
parent | f2fdec3ab7e76fe42216b03b416e39ed81f5ff9c (diff) |
OpenGL: draw box outlines with lines, not rectangles
2 reasons:
- fewer state changes (PolygonMode)
- glRect goes away in later GL versions
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6daf2d4a4ab..c66647e009e 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1144,19 +1144,16 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) glDisable(GL_BLEND); } - /* edge */ - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - setlinestyle(0); UI_ThemeColor(TH_BACK); - glRectf(x1i, y1i, x2i, y2i); + fdrawbox(x1i, y1i, x2i, y2i); #ifdef VIEW3D_CAMERA_BORDER_HACK if (view3d_camera_border_hack_test == true) { glColor3ubv(view3d_camera_border_hack_col); - glRectf(x1i + 1, y1i + 1, x2i - 1, y2i - 1); + fdrawbox(x1i + 1, y1i + 1, x2i - 1, y2i - 1); view3d_camera_border_hack_test = false; } #endif @@ -1166,11 +1163,11 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) /* outer line not to confuse with object selecton */ if (v3d->flag2 & V3D_LOCK_CAMERA) { UI_ThemeColor(TH_REDALERT); - glRectf(x1i - 1, y1i - 1, x2i + 1, y2i + 1); + fdrawbox(x1i - 1, y1i - 1, x2i + 1, y2i + 1); } UI_ThemeColor(TH_VIEW_OVERLAY); - glRectf(x1i, y1i, x2i, y2i); + fdrawbox(x1i, y1i, x2i, y2i); /* border */ if (scene->r.mode & R_BORDER) { @@ -1182,7 +1179,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) y4 = y1i + 1 + roundf(scene->r.border.ymax * (y2 - y1)); cpack(0x4040FF); - glRecti(x3, y3, x4, y4); + sdrawbox(x3, y3, x4, y4); } /* safety border */ @@ -1298,7 +1295,6 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) } setlinestyle(0); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* camera name - draw in highlighted text color */ if (ca && (ca->flag & CAM_SHOWNAME)) { @@ -3964,15 +3960,13 @@ static void view3d_main_region_draw_info(const bContext *C, Scene *scene, drawviewborder(scene, ar, v3d); } else if (v3d->flag2 & V3D_RENDER_BORDER) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); setlinestyle(3); cpack(0x4040FF); - glRecti(v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy, - v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy); + sdrawbox(v3d->render_border.xmin * ar->winx, v3d->render_border.ymin * ar->winy, + v3d->render_border.xmax * ar->winx, v3d->render_border.ymax * ar->winy); setlinestyle(0); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } if (v3d->flag2 & V3D_SHOW_GPENCIL) { |