From 010ec30656bae5bd219d4bce5d5dc2bad91b5c8f Mon Sep 17 00:00:00 2001 From: codeanticode Date: Mon, 6 Jun 2011 09:52:52 +0000 Subject: [PATCH] noFill doesn't affect texturing in OPENGL2 --- .../processing/opengl2/PGraphicsOpenGL2.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/java/libraries/opengl2/src/processing/opengl2/PGraphicsOpenGL2.java b/java/libraries/opengl2/src/processing/opengl2/PGraphicsOpenGL2.java index 042cfad58..d4f341b9d 100644 --- a/java/libraries/opengl2/src/processing/opengl2/PGraphicsOpenGL2.java +++ b/java/libraries/opengl2/src/processing/opengl2/PGraphicsOpenGL2.java @@ -403,6 +403,9 @@ public class PGraphicsOpenGL2 extends PGraphics { /** Number of textures currently in use. */ protected int numTextures; + /** Number of textures used by a shape. */ + protected int shapeTextures; + /** Number of currently initialized texture buffers. */ protected int numTexBuffers; @@ -1438,6 +1441,7 @@ public class PGraphicsOpenGL2 extends PGraphics { triangleCount = 0; } + shapeTextures = 0; noTexture(); } @@ -1463,7 +1467,8 @@ public class PGraphicsOpenGL2 extends PGraphics { super.texture(image); textureImages[0] = image; java.util.Arrays.fill(textureImages, 1, maxTextureUnits, null); - numTextures = 1; + numTextures = 1; + shapeTextures++; } @@ -1477,6 +1482,7 @@ public class PGraphicsOpenGL2 extends PGraphics { if (numTexBuffers < len) { addTexBuffers(len - numTexBuffers); } + shapeTextures += len; } else { System.err.println("OPENGL2: insufficient texture units."); } @@ -1685,21 +1691,22 @@ public class PGraphicsOpenGL2 extends PGraphics { endShapeStroke(mode); } - if (fill) { + if (fill || 0 < shapeTextures) { endShapeFill(); } // render shape and fill here if not saving the shapes for later // if true, the shapes will be rendered on endDraw if (!hints[ENABLE_DEPTH_SORT]) { - if (fill) { + if (fill || 0 < shapeTextures) { renderTriangles(0, faceCount); if (raw != null) { // rawTriangles(0, triangleCount); } - + vertexCount = 0; - triangleCount = 0; + triangleCount = 0; + shapeTextures = 0; } if (stroke) { @@ -2407,8 +2414,6 @@ public class PGraphicsOpenGL2 extends PGraphics { for (int j = start; j < stop; j++) { int i = faceOffset[j]; - - PImage[] images = faceTextures[j]; if (1 < numTextures) {