From 8143cf37e4e37d205e68ffb2f55df36e70e9ccf5 Mon Sep 17 00:00:00 2001 From: codeanticode Date: Fri, 4 May 2012 21:04:28 +0000 Subject: [PATCH] tessellator object is static --- .../src/processing/opengl/PGraphicsOpenGL.java | 12 +++++++++--- .../opengl/src/processing/opengl/PShape3D.java | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java index ec3dda2da..ac78a289f 100644 --- a/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/java/libraries/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -182,7 +182,7 @@ public class PGraphicsOpenGL extends PGraphics { protected int firstTexIndex; protected int firstTexCache; protected TexCache texCache; - protected Tessellator tessellator; + static protected Tessellator tessellator; // ........................................................ @@ -388,7 +388,9 @@ public class PGraphicsOpenGL extends PGraphics { pgl = new PGL(this); pg = null; - tessellator = new Tessellator(); + if (tessellator == null) { + tessellator = new Tessellator(); + } inGeo = newInGeometry(IMMEDIATE); tessGeo = newTessGeometry(IMMEDIATE); @@ -6780,7 +6782,11 @@ public class PGraphicsOpenGL extends PGraphics { void disposeTessMap() { tessMap.dispose(); } - + + void compactTessMap() { + tessMap.compact(); + } + // ----------------------------------------------------------------- // // Query diff --git a/java/libraries/opengl/src/processing/opengl/PShape3D.java b/java/libraries/opengl/src/processing/opengl/PShape3D.java index 7e2c281b4..6f1a50db9 100644 --- a/java/libraries/opengl/src/processing/opengl/PShape3D.java +++ b/java/libraries/opengl/src/processing/opengl/PShape3D.java @@ -269,7 +269,7 @@ public class PShape3D extends PShape { glPointSizeBufferID = 0; glPointIndexBufferID = 0; - this.tessellator = pg.tessellator; + this.tessellator = PGraphicsOpenGL.tessellator; this.family = family; this.root = this; this.parent = null; @@ -277,7 +277,7 @@ public class PShape3D extends PShape { if (family == GEOMETRY || family == PRIMITIVE || family == PATH) { inGeo = pg.newInGeometry(PGraphicsOpenGL.RETAINED); - } + } // Modes are retrieved from the current values in the renderer. textureMode = pg.textureMode; @@ -2526,7 +2526,7 @@ public class PShape3D extends PShape { tessGeo.applyMatrix(matrix); } - inGeo.tessMap.compact(); + inGeo.compactTessMap(); } }