[Bf-blender-cvs] [1731e94] blender2.8: draw gpencil erase cursor with new imm mode
Mike Erwin
noreply at git.blender.org
Wed Oct 5 20:06:15 CEST 2016
Commit: 1731e94d0c3888c4482be80fe3598bbfcd60c77c
Author: Mike Erwin
Date: Wed Oct 5 14:05:55 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB1731e94d0c3888c4482be80fe3598bbfcd60c77c
draw gpencil erase cursor with new imm mode
Part of T49043 and T49450.
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index cc45cbd..4a5b170 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -68,9 +68,10 @@
#include "ED_view3d.h"
#include "ED_clip.h"
-#include "BIF_gl.h"
#include "BIF_glutil.h"
+#include "GPU_immediate.h"
+
#include "RNA_access.h"
#include "RNA_define.h"
@@ -1750,28 +1751,28 @@ static void gp_paint_cleanup(tGPsdata *p)
static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
{
tGPsdata *p = (tGPsdata *)p_ptr;
-
+
if (p->paintmode == GP_PAINTMODE_ERASER) {
- 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);
-
- glColor4ub(255, 100, 100, 20);
- glutil_draw_filled_arc(0.0, M_PI * 2.0, p->radius, 40);
-
- setlinestyle(6);
-
- glColor4ub(255, 100, 100, 200);
- glutil_draw_lined_arc(0.0, M_PI * 2.0, p->radius, 40);
-
+
+ immUniformColor4ub(255, 100, 100, 20);
+ imm_draw_filled_circle(pos, x, y, p->radius, 40);
+
+ setlinestyle(6); /* TODO: handle line stipple in shader */
+
+ immUniformColor4ub(255, 100, 100, 200);
+ imm_draw_lined_circle(pos, x, y, p->radius, 40);
+
+ immUnbindProgram();
+
setlinestyle(0);
glDisable(GL_BLEND);
glDisable(GL_LINE_SMOOTH);
-
- glPopMatrix();
}
}
More information about the Bf-blender-cvs
mailing list