From 9663afe69c4b2be28c935c721881c675436edf08 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Wed, 23 May 2012 01:55:10 +0000 Subject: [PATCH] Fixed the shape break logic in immediate and retained mode --- .../src/processing/opengl/PGraphicsOpenGL.java | 7 +++---- .../opengl/src/processing/opengl/PShapeOpenGL.java | 14 +++----------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index e052f3c79..9eab67559 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -35,7 +35,6 @@ import processing.core.PVector; import java.net.URL; import java.nio.*; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.EmptyStackException; import java.util.HashMap; @@ -1948,7 +1947,7 @@ public class PGraphicsOpenGL extends PGraphics { inGeo.clear(); - breakShape = false; + breakShape = true; defaultEdges = true; textureImage0 = textureImage; @@ -2035,6 +2034,7 @@ public class PGraphicsOpenGL extends PGraphics { return; } openContour = true; + breakShape = true; } @@ -2043,8 +2043,7 @@ public class PGraphicsOpenGL extends PGraphics { showWarning("P3D: Need to call beginContour() first."); return; } - openContour = false; - breakShape = true; + openContour = false; } diff --git a/java/libraries/opengl/src/processing/opengl/PShapeOpenGL.java b/java/libraries/opengl/src/processing/opengl/PShapeOpenGL.java index 80935ea8f..5f86e8a03 100644 --- a/java/libraries/opengl/src/processing/opengl/PShapeOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PShapeOpenGL.java @@ -3064,8 +3064,6 @@ public class PShapeOpenGL extends PShape { inGeo.setMaterial(fillColor, strokeColor, strokeWeight, ambientColor, specularColor, emissiveColor, shininess); - boolean insideContour = false; - if (vertexCodeCount == 0) { // each point is a simple vertex if (vertices[0].length == 2) { // tesellating 2D vertices for (int i = 0; i < vertexCount; i++) { @@ -3078,7 +3076,7 @@ public class PShapeOpenGL extends PShape { } } else { // coded set of vertices int index = 0; - int code = VERTEX; + int code = BREAK; if (vertices[0].length == 2) { // tessellating a 2D path @@ -3115,10 +3113,7 @@ public class PShapeOpenGL extends PShape { index++; case BREAK: - if (insideContour) { - code = BREAK; - } - insideContour = true; + code = BREAK; } } } else { // tessellating a 3D path @@ -3156,10 +3151,7 @@ public class PShapeOpenGL extends PShape { index++; case BREAK: - if (insideContour) { - code = BREAK; - } - insideContour = true; + code = BREAK; } } }