diff options
author | Mike Erwin <significant.bit@gmail.com> | 2016-10-05 20:45:28 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2016-10-05 20:45:28 +0300 |
commit | e874f3cdc59de444ca792f4c2d79ae368ecef5e9 (patch) | |
tree | 9c6190ef6e9b5ba3721b83c2fb704560be5f79ad /source/blender | |
parent | c4625006185202f9bf82c664d08692c6fde3f654 (diff) |
draw gpencil sculpt cursor with new imm mode
Part of T49043 and T49450.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_brush.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index 8576cbca239..7fee8af796a 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -75,9 +75,10 @@ #include "ED_screen.h" #include "ED_view3d.h" -#include "BIF_gl.h" #include "BIF_glutil.h" +#include "GPU_immediate.h" + #include "gpencil_intern.h" /* ************************************************ */ @@ -958,28 +959,28 @@ static bool gpsculpt_brush_apply_clone(bContext *C, tGP_BrushEditData *gso) static void gp_brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata)) { GP_EditBrush_Data *brush = gpsculpt_get_brush(CTX_data_scene(C)); - + if (brush) { - glPushMatrix(); - - glTranslatef((float)x, (float)y, 0.0f); - + VertexFormat *format = immVertexFormat(); + unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - + /* Inner Ring: Light color for action of the brush */ /* TODO: toggle between add and remove? */ - glColor4ub(255, 255, 255, 200); - glutil_draw_lined_arc(0.0, M_PI * 2.0, brush->size, 40); - + immUniformColor4ub(255, 255, 255, 200); + imm_draw_lined_circle(pos, x, y, brush->size, 40); + /* Outer Ring: Dark color for contrast on light backgrounds (e.g. gray on white) */ - glColor3ub(30, 30, 30); - glutil_draw_lined_arc(0.0, M_PI * 2.0, brush->size + 1, 40); - + immUniformColor3ub(30, 30, 30); + imm_draw_lined_circle(pos, x, y, brush->size + 1, 40); + + immUnbindProgram(); + glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); - - glPopMatrix(); } } |