From 406d38d51e3cde39ab8d70bbc5bd9c0c7debffd5 Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Sat, 26 Jul 2014 02:00:26 +0200 Subject: [PATCH] Fixed error reporting for bez/quad/curve vertices When user calls bezierVertex()/quadraticVertex()/curveVertex() and does not call beginShape()/beginShape(POLYGON) before or forgets to specify first vertex(), proper error message is shown. --- core/src/processing/core/PGraphics.java | 2 +- core/src/processing/opengl/PGraphicsOpenGL.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 7d950eecc..c8776a2e1 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -1867,7 +1867,7 @@ public class PGraphics extends PImage implements PConstants { "must be used before bezierVertex() or quadraticVertex()"); } if (vertexCount == 0) { - throw new RuntimeException("vertex() must be used at least once" + + throw new RuntimeException("vertex() must be used at least once " + "before bezierVertex() or quadraticVertex()"); } } diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 541f1981c..c6ae59cb9 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -3056,6 +3056,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void bezierVertexImpl(float x2, float y2, float z2, float x3, float y3, float z3, float x4, float y4, float z4) { + bezierVertexCheck(shape, inGeo.vertexCount); inGeo.setMaterial(fillColor, strokeColor, strokeWeight, ambientColor, specularColor, emissiveColor, shininess); inGeo.setNormal(normalX, normalY, normalZ); @@ -3083,6 +3084,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void quadraticVertexImpl(float cx, float cy, float cz, float x3, float y3, float z3) { + bezierVertexCheck(shape, inGeo.vertexCount); inGeo.setMaterial(fillColor, strokeColor, strokeWeight, ambientColor, specularColor, emissiveColor, shininess); inGeo.setNormal(normalX, normalY, normalZ); @@ -3109,6 +3111,7 @@ public class PGraphicsOpenGL extends PGraphics { protected void curveVertexImpl(float x, float y, float z) { + curveVertexCheck(shape); inGeo.setMaterial(fillColor, strokeColor, strokeWeight, ambientColor, specularColor, emissiveColor, shininess); inGeo.setNormal(normalX, normalY, normalZ);