From ca508802db568cb00c9e187a6542ad621c061bc2 Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Tue, 9 Jun 2015 18:36:29 +0200 Subject: [PATCH] Fix sorter buffer size --- core/src/processing/opengl/PGraphicsOpenGL.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index ad5faa1c0..9f7d22fe4 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -13188,7 +13188,7 @@ public class PGraphicsOpenGL extends PGraphics { texCacheMap = new int[triangleCount]; indexCacheMap = new int[triangleCount]; - screenVertices = new float[4*triangleCount]; + screenVertices = new float[9*triangleCount]; swapped = new int[8]; marked = new int[8]; @@ -13203,10 +13203,11 @@ public class PGraphicsOpenGL extends PGraphics { { // Map vertices to screen float[] polyVertices = tessGeo.polyVertices; - if (screenVertices.length != tessGeo.polyVertices.length) { - screenVertices = new float[tessGeo.polyVertices.length]; + int polyVertexCount = tessGeo.polyVertexCount; + if (screenVertices.length < 3*polyVertexCount) { + screenVertices = new float[3*polyVertexCount]; } - for (int i = 0; i < tessGeo.polyVertexCount; i++) { + for (int i = 0; i < polyVertexCount; i++) { float x = polyVertices[4*i+X]; float y = polyVertices[4*i+Y]; float z = polyVertices[4*i+Z];