noFill doesn't affect texturing in OPENGL2

This commit is contained in:
codeanticode
2011-06-06 09:52:52 +00:00
parent 37a0926b0e
commit 010ec30656

View File

@@ -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) {