OpenGL: draw box outlines with lines, not rectangles
2 reasons: - fewer state changes (PolygonMode) - glRect goes away in later GL versions
This commit is contained in:
@@ -338,9 +338,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_d
|
||||
|
||||
/* draw outline */
|
||||
glColor3ub(128, 128, 128);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glRecti(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
sdrawbox(color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax);
|
||||
|
||||
dx += 1.75f * UI_UNIT_X;
|
||||
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user