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:
authorLuca Rood <dev@lucarood.com>2017-02-23 08:52:36 +0300
committerLuca Rood <dev@lucarood.com>2017-02-23 09:21:58 +0300
commit3b3ed19c187242cde0d0aa9d932176dc8dded30c (patch)
tree70a709a3988300f4d87ea6d154e7fd4c4f9274c4 /source/blender/editors/sculpt_paint/paint_stroke.c
parent30420845b9fa59dcb78c9a5f2a30c819ab26d5b6 (diff)
OpenGl immediate mode: remove imm_draw_line
Replaced all calls to `imm_draw_line` by plain `immVertex2f` calls, and removed `imm_draw_line`, as that function was not supposed to exist in the first place, and causes unnecessary calls to `immBegin`/`immEnd`. Part of T49043
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_stroke.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_stroke.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c
index 38827b16e31..e6113f2c2c3 100644
--- a/source/blender/editors/sculpt_paint/paint_stroke.c
+++ b/source/blender/editors/sculpt_paint/paint_stroke.c
@@ -151,9 +151,10 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata
immUniformColor4ubv(paint->paint_cursor_col);
immBegin(GL_LINES, 2);
- imm_draw_line(pos, x, y, stroke->last_mouse_position[0],
- stroke->last_mouse_position[1]);
+ immVertex2f(pos, x, y);
+ immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
immEnd();
+
immUnbindProgram();
glDisable(GL_BLEND);
@@ -176,25 +177,36 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata)
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4ub(0, 0, 0, paint->paint_cursor_col[3]);
+
+ immBegin(GL_LINES, 2);
+
if (stroke->constrain_line) {
- imm_draw_line(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1],
- stroke->constrained_pos[0], stroke->constrained_pos[1]);
+ immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
+ immVertex2f(pos, stroke->constrained_pos[0], stroke->constrained_pos[1]);
}
else {
- imm_draw_line(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1],
- x, y);
+ immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
+ immVertex2f(pos, x, y);
}
+ immEnd();
+
glLineWidth(1.0f);
immUniformColor4ub(255, 255, 255, paint->paint_cursor_col[3]);
+
+ immBegin(GL_LINES, 2);
+
if (stroke->constrain_line) {
- imm_draw_line(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1],
- stroke->constrained_pos[0], stroke->constrained_pos[1]);
+ immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
+ immVertex2f(pos, stroke->constrained_pos[0], stroke->constrained_pos[1]);
}
else {
- imm_draw_line(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1],
- x, y);
+ immVertex2f(pos, stroke->last_mouse_position[0], stroke->last_mouse_position[1]);
+ immVertex2f(pos, x, y);
}
+
+ immEnd();
+
immUnbindProgram();
setlinestyle(0);