[Bf-blender-cvs] [46a0698] blender2.8: draw gpencil dots smooth

Mike Erwin noreply at git.blender.org
Tue Oct 18 19:15:02 CEST 2016


Commit: 46a069822a50a417fe74be100a3ce798f6ad6589
Author: Mike Erwin
Date:   Tue Oct 18 13:07:35 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB46a069822a50a417fe74be100a3ce798f6ad6589

draw gpencil dots smooth

Some strokes are just single dots. Draw these smooth / antialiased.

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

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

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

diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 29230df..c406a0d 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -629,10 +629,10 @@ static void gp_draw_stroke_point(
 	unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
 
 	if (sflag & GP_STROKE_3DSPACE) {
-		immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR);
+		immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH);
 	}
 	else {
-		immBindBuiltinProgram(GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR);
+		immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_SMOOTH);
 
 		/* get 2D coordinates of point */
 		float co[3] = { 0.0f };
@@ -641,9 +641,8 @@ static void gp_draw_stroke_point(
 	}
 
 	gp_set_point_uniform_color(pt, ink);
-
 	/* set point thickness (since there's only one of these) */
-	glPointSize((float)(thickness + 2) * pt->pressure);
+	immUniform1f("size", (float)(thickness + 2) * pt->pressure);
 
 	immBegin(GL_POINTS, 1);
 	immVertex3fv(pos, fpt);
@@ -999,6 +998,8 @@ static void gp_draw_strokes(
 	short sthickness;
 	float ink[4];
 
+	GPU_enable_program_point_size();
+
 	for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
 		/* check if stroke can be drawn */
 		if (gp_can_draw_stroke(gps, dflag) == false) {
@@ -1161,6 +1162,8 @@ static void gp_draw_strokes(
 			}
 		}
 	}
+
+	GPU_disable_program_point_size();
 }
 
 /* Draw selected verts for strokes being edited */




More information about the Bf-blender-cvs mailing list