diff --git a/java/libraries/opengl/examples/Retained/PolyImmediate/PolyImmediate.pde b/java/libraries/opengl/examples/Retained/PolyImmediate/PolyImmediate.pde index ecf02efa2..8efcd50b7 100755 --- a/java/libraries/opengl/examples/Retained/PolyImmediate/PolyImmediate.pde +++ b/java/libraries/opengl/examples/Retained/PolyImmediate/PolyImmediate.pde @@ -3,16 +3,19 @@ size(100, 100, P3D); beginShape(POLYGON); fill(0, 255, 0, 255); stroke(0, 0, 255, 255); -strokeWeight(10); +strokeWeight(5); strokeJoin(ROUND); +beginContour(); vertex(10, 10); vertex(10, 90); vertex(90, 90); vertex(90, 10); -breakShape(); +endContour(); +beginContour(); vertex(40, 40); vertex(70, 40); vertex(70, 70); vertex(40, 70); +endContour(); endShape(CLOSE); diff --git a/java/libraries/opengl/examples/Retained/PolyRetain/PolyRetain.pde b/java/libraries/opengl/examples/Retained/PolyRetain/PolyRetain.pde index 3fc7961a8..54b260c06 100755 --- a/java/libraries/opengl/examples/Retained/PolyRetain/PolyRetain.pde +++ b/java/libraries/opengl/examples/Retained/PolyRetain/PolyRetain.pde @@ -3,17 +3,20 @@ size(100, 100, P3D); PShape3D obj = (PShape3D)createShape(POLYGON); obj.fill(0, 255, 0, 255); obj.stroke(0, 0, 255, 255); -obj.strokeWeight(10); +obj.strokeWeight(5); obj.strokeJoin(ROUND); +obj.beginContour(); obj.vertex(10, 10); obj.vertex(10, 90); obj.vertex(90, 90); obj.vertex(90, 10); -obj.breakShape(); +obj.endContour(); +obj.beginContour(); obj.vertex(40, 40); obj.vertex(70, 40); obj.vertex(70, 70); obj.vertex(40, 70); +obj.endContour(); obj.end(CLOSE); shape(obj); diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index c2e635a6d..3ef24f62c 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -8529,8 +8529,8 @@ public class PGraphicsOpenGL extends PGraphics { float dy = y1 - y0; float len = PApplet.sqrt(dx * dx + dy * dy); - float linePerpX = -dy * (strokeWeight / len); - float linePerpY = dx * (strokeWeight / len); + float linePerpX = -dy * (0.5f * strokeWeight / len); + float linePerpY = dx * (0.5f * strokeWeight / len); tessGeo.putLineVertexIntoFill(inGeo, i0, +linePerpX, +linePerpY, vcount); tessGeo.fillIndices[icount++] = vcount;