Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Erwin <significant.bit@gmail.com>2016-01-22 09:03:15 +0300
committerMike Erwin <significant.bit@gmail.com>2016-01-22 10:52:11 +0300
commit4c6836401e9766c9398de2f461663b50d1f49f71 (patch)
treeb329a616f1a934b9d20eadd641f2ba5984443b62 /source/blender
parent017c45b966eccef9902154362d1c2aef661d0622 (diff)
OpenGL: pull glBegin/End out of loops
When drawing 2D grid and 3D axes.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/interface/view2d.c18
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c4
2 files changed, 7 insertions, 15 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index cfa7622c444..b57c8a797b7 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1298,7 +1298,9 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
/* check for grid first, as it may not exist */
if (grid == NULL)
return;
-
+
+ glBegin(GL_LINES);
+
/* vertical lines */
if (flag & V2D_VERTICAL_LINES) {
/* initialize initial settings */
@@ -1311,10 +1313,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
UI_ThemeColor(TH_GRID);
for (a = 0; a < step; a++) {
- glBegin(GL_LINE_STRIP);
glVertex2fv(vec1);
glVertex2fv(vec2);
- glEnd();
vec2[0] = vec1[0] += grid->dx;
}
@@ -1325,10 +1325,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
step++;
for (a = 0; a <= step; a++) {
- glBegin(GL_LINE_STRIP);
glVertex2fv(vec1);
glVertex2fv(vec2);
- glEnd();
vec2[0] = vec1[0] -= grid->dx;
}
@@ -1345,10 +1343,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
UI_ThemeColor(TH_GRID);
for (a = 0; a <= step; a++) {
- glBegin(GL_LINE_STRIP);
glVertex2fv(vec1);
glVertex2fv(vec2);
- glEnd();
vec2[1] = vec1[1] += grid->dy;
}
@@ -1360,10 +1356,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
if (flag & V2D_HORIZONTAL_FINELINES) {
UI_ThemeColorShade(TH_GRID, 16);
for (a = 0; a < step; a++) {
- glBegin(GL_LINE_STRIP);
glVertex2fv(vec1);
glVertex2fv(vec2);
- glEnd();
vec2[1] = vec1[1] -= grid->dy;
}
@@ -1379,10 +1373,8 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
vec2[0] = v2d->cur.xmax;
vec1[1] = vec2[1] = 0.0f;
- glBegin(GL_LINE_STRIP);
glVertex2fv(vec1);
glVertex2fv(vec2);
- glEnd();
}
/* vertical axis */
@@ -1391,11 +1383,11 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag)
vec2[1] = v2d->cur.ymax;
vec1[0] = vec2[0] = 0.0f;
- glBegin(GL_LINE_STRIP);
glVertex2fv(vec1);
glVertex2fv(vec2);
- glEnd();
}
+
+ glEnd();
}
/* Draw a constant grid in given 2d-region */
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 4d73e0bc227..6daf2d4a4ab 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -535,6 +535,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
/* draw the Z axis line */
/* check for the 'show Z axis' preference */
if (v3d->gridflag & (V3D_SHOW_X | V3D_SHOW_Y | V3D_SHOW_Z)) {
+ glBegin(GL_LINES);
int axis;
for (axis = 0; axis < 3; axis++) {
if (v3d->gridflag & (V3D_SHOW_X << axis)) {
@@ -544,15 +545,14 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
UI_make_axis_color(col_grid, tcol, 'X' + axis);
glColor3ubv(tcol);
- glBegin(GL_LINE_STRIP);
zero_v3(vert);
vert[axis] = grid;
glVertex3fv(vert);
vert[axis] = -grid;
glVertex3fv(vert);
- glEnd();
}
}
+ glEnd();
}
glDepthMask(GL_TRUE);