From 8e189ebb83349badd9c27b124667aaaa0372eb5f Mon Sep 17 00:00:00 2001 From: benfry Date: Fri, 31 Jul 2009 17:53:50 +0000 Subject: [PATCH] image() doesn't work with P2D, P3D, and OPENGL with noFill() (bug #1299) --- core/src/processing/core/PGraphics2D.java | 12 ++++++------ core/src/processing/core/PGraphics3D.java | 4 ++-- core/src/processing/core/PPolygon.java | 2 +- core/todo.txt | 6 ++++++ 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/core/src/processing/core/PGraphics2D.java b/core/src/processing/core/PGraphics2D.java index 68c19ea30..0c0bfa77e 100644 --- a/core/src/processing/core/PGraphics2D.java +++ b/core/src/processing/core/PGraphics2D.java @@ -283,7 +283,7 @@ public class PGraphics2D extends PGraphics { case TRIANGLE_FAN: // do fill and stroke separately because otherwise // the lines will be stroked more than necessary - if (fill) { + if (fill || textureImage != null) { fpolygon.vertexCount = 3; for (int i = 1; i < vertexCount-1; i++) { @@ -342,7 +342,7 @@ public class PGraphics2D extends PGraphics { increment = (shape == TRIANGLES) ? 3 : 1; // do fill and stroke separately because otherwise // the lines will be stroked more than necessary - if (fill) { + if (fill || textureImage != null) { fpolygon.vertexCount = 3; for (int i = 0; i < vertexCount-2; i += increment) { for (int j = 0; j < 3; j++) { @@ -379,7 +379,7 @@ public class PGraphics2D extends PGraphics { break; case QUADS: - if (fill) { + if (fill || textureImage != null) { fpolygon.vertexCount = 4; for (int i = 0; i < vertexCount-3; i += 4) { for (int j = 0; j < 4; j++) { @@ -412,7 +412,7 @@ public class PGraphics2D extends PGraphics { break; case QUAD_STRIP: - if (fill) { + if (fill || textureImage != null) { fpolygon.vertexCount = 4; for (int i = 0; i < vertexCount-3; i += 2) { for (int j = 0; j < 4; j++) { @@ -445,7 +445,7 @@ public class PGraphics2D extends PGraphics { case POLYGON: if (isConvex()) { - if (fill) { + if (fill || textureImage != null) { //System.out.println("convex"); fpolygon.renderPolygon(vertices, vertexCount); //if (stroke) polygon.unexpand(); @@ -463,7 +463,7 @@ public class PGraphics2D extends PGraphics { } } else { // not convex //System.out.println("concave"); - if (fill) { + if (fill || textureImage != null) { // the triangulator produces polygons that don't align // when smoothing is enabled. but if there is a stroke around // the polygon, then smoothing can be temporarily disabled. diff --git a/core/src/processing/core/PGraphics3D.java b/core/src/processing/core/PGraphics3D.java index bf3c74326..ba5af3c15 100644 --- a/core/src/processing/core/PGraphics3D.java +++ b/core/src/processing/core/PGraphics3D.java @@ -608,7 +608,7 @@ public class PGraphics3D extends PGraphics { endShapeStroke(mode); } - if (fill) { + if (fill || textureImage != null) { endShapeFill(); } @@ -622,7 +622,7 @@ public class PGraphics3D extends PGraphics { // 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 || textureImage != null) { if (triangleCount > 0) { renderTriangles(0, triangleCount); if (raw != null) { diff --git a/core/src/processing/core/PPolygon.java b/core/src/processing/core/PPolygon.java index 2a20b7c78..0651fbe2d 100644 --- a/core/src/processing/core/PPolygon.java +++ b/core/src/processing/core/PPolygon.java @@ -419,7 +419,7 @@ public class PPolygon implements PConstants { int tr, tg, tb, ta; // System.out.println("P2D interp uv " + interpUV + " " + -// vertices[2][U] + " " + vertices[2][V]); +// vertices[2][U] + " " + vertices[2][V]); for (int x = lx; x <= rx; x++) { // map texture based on U, V coords in sp[U] and sp[V] if (interpUV) { diff --git a/core/todo.txt b/core/todo.txt index 0575dd2ce..25b82ad20 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -4,6 +4,12 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=1282 X strokeWeight() makes lines 2x too thick with P2D X http://dev.processing.org/bugs/show_bug.cgi?id=1283 +_ image() doesn't work with P2D and P3D if noFill() is in use +_ maybe using rgb instead of tint inside drawing loops? + +_ file chooser fails with opengl on linux +_ http://dev.processing.org/bugs/show_bug.cgi?id=1221 + _ resizing opengl destroys context and textures _ http://dev.processing.org/bugs/show_bug.cgi?id=1176 _ what's the difference with ascent on loadFont vs. createFont?