[Bf-blender-cvs] [e874f3c] blender2.8: draw gpencil sculpt cursor with new imm mode

Mike Erwin noreply at git.blender.org
Wed Oct 5 19:45:59 CEST 2016


Commit: e874f3cdc59de444ca792f4c2d79ae368ecef5e9
Author: Mike Erwin
Date:   Wed Oct 5 13:45:28 2016 -0400
Branches: blender2.8
https://developer.blender.org/rBe874f3cdc59de444ca792f4c2d79ae368ecef5e9

draw gpencil sculpt cursor with new imm mode

Part of T49043 and T49450.

===================================================================

M	source/blender/editors/gpencil/gpencil_brush.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c
index 8576cbc..7fee8af 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();
 	}
 }




More information about the Bf-blender-cvs mailing list