From 30ce02d0ec421e5f74e3ee4f04d9bc05472bc7cd Mon Sep 17 00:00:00 2001 From: codeanticode Date: Fri, 18 Oct 2013 16:15:32 -0400 Subject: [PATCH] reset curveVertexCount when tessellating a polygon PShape --- core/src/processing/opengl/PGraphicsOpenGL.java | 6 +++++- core/src/processing/opengl/PShapeOpenGL.java | 10 ++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 0cd5dc208..c9966f2ab 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -2069,6 +2069,7 @@ public class PGraphicsOpenGL extends PGraphics { shape = kind; inGeo.clear(); + curveVertexCount = 0; breakShape = false; defaultEdges = true; @@ -10249,6 +10250,10 @@ public class PGraphicsOpenGL extends PGraphics { transformScale = -1; } + void resetCurveVertexCount() { + pg.curveVertexCount = 0; + } + // ----------------------------------------------------------------- // // Point tessellation @@ -11983,7 +11988,6 @@ public class PGraphicsOpenGL extends PGraphics { vertex[X] = in.vertices[3*i + 0]; vertex[Y] = in.vertices[3*i + 1]; vertex[Z] = in.vertices[3*i + 2]; - pg.curveVertexCount++; // draw a segment if there are enough points diff --git a/core/src/processing/opengl/PShapeOpenGL.java b/core/src/processing/opengl/PShapeOpenGL.java index 462e2f56f..b04575c5e 100644 --- a/core/src/processing/opengl/PShapeOpenGL.java +++ b/core/src/processing/opengl/PShapeOpenGL.java @@ -2662,7 +2662,10 @@ public class PShapeOpenGL extends PShape { boolean quad = inGeo.hasQuadraticVertex(); boolean curv = inGeo.hasCurveVertex(); if (bez || quad) saveBezierVertexSettings(); - if (curv) saveCurveVertexSettings(); + if (curv) { + saveCurveVertexSettings(); + tessellator.resetCurveVertexCount(); + } tessellator.tessellatePolygon(solid, close, normalMode == NORMAL_MODE_AUTO); if (bez ||quad) restoreBezierVertexSettings(); @@ -3182,7 +3185,10 @@ public class PShapeOpenGL extends PShape { boolean quad = inGeo.hasQuadraticVertex(); boolean curv = inGeo.hasCurveVertex(); if (bez || quad) saveBezierVertexSettings(); - if (curv) saveCurveVertexSettings(); + if (curv) { + saveCurveVertexSettings(); + tessellator.resetCurveVertexCount(); + } tessellator.tessellatePolygon(false, close, true); if (bez || quad) restoreBezierVertexSettings(); if (curv) restoreCurveVertexSettings();