[Bf-blender-cvs] [a7cae29] master: OpenGL does not like line thickness less than 1.0.

Antony Riakiotakis noreply at git.blender.org
Thu Apr 16 18:37:00 CEST 2015


Commit: a7cae2987d078da8a3cb9a293fbcdf3b6ab43ddb
Author: Antony Riakiotakis
Date:   Thu Apr 16 18:34:53 2015 +0200
Branches: master
https://developer.blender.org/rBa7cae2987d078da8a3cb9a293fbcdf3b6ab43ddb

OpenGL does not like line thickness less than 1.0.

Check here is not completely correct either, we should check against
GL_ALIASED_LINE_WIDTH_RANGE and GL_SMOOTH_LINE_WIDTH_RANGE

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

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

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

diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index d4d601b..0892692 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -121,7 +121,7 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
 		/* draw stroke curve */
 		if (G.debug & G_DEBUG) setlinestyle(2);
 		
-		glLineWidth(oldpressure * thickness);
+		glLineWidth(max_ff(oldpressure * thickness, 1.0));
 		glBegin(GL_LINE_STRIP);
 		
 		for (i = 0, pt = points; i < totpoints && pt; i++, pt++) {
@@ -130,7 +130,7 @@ static void gp_draw_stroke_buffer(tGPspoint *points, int totpoints, short thickn
 			 */
 			if (fabsf(pt->pressure - oldpressure) > 0.2f) {
 				glEnd();
-				glLineWidth(pt->pressure * thickness);
+				glLineWidth(max_ff(pt->pressure * thickness, 1.0f));
 				glBegin(GL_LINE_STRIP);
 				
 				/* need to roll-back one point to ensure that there are no gaps in the stroke */
@@ -415,7 +415,7 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
 	int i;
 	
 	/* draw stroke curve */
-	glLineWidth(curpressure * thickness);
+	glLineWidth(max_ff(curpressure * thickness, 1.0f));
 	glBegin(GL_LINE_STRIP);
 	for (i = 0, pt = points; i < totpoints && pt; i++, pt++) {
 		/* if there was a significant pressure change, stop the curve, change the thickness of the stroke,
@@ -425,7 +425,7 @@ static void gp_draw_stroke_3d(bGPDspoint *points, int totpoints, short thickness
 		if (fabsf(pt->pressure - curpressure) > 0.2f / (float)thickness) {
 			glEnd();
 			curpressure = pt->pressure;
-			glLineWidth(curpressure * thickness);
+			glLineWidth(max_ff(curpressure * thickness, 1.0f));
 			glBegin(GL_LINE_STRIP);
 			
 			/* need to roll-back one point to ensure that there are no gaps in the stroke */




More information about the Bf-blender-cvs mailing list