diff --git a/core/PGraphics.java b/core/PGraphics.java index e4d559bec..4d7c49f65 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -201,8 +201,9 @@ public class PGraphics extends PImage implements PConstants { // vertices static final int DEFAULT_VERTICES = 512; - public float vertices[][] = new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT]; - int vertexCount; // total number of vertices + protected float vertices[][] = + new float[DEFAULT_VERTICES][VERTEX_FIELD_COUNT]; + protected int vertexCount; // total number of vertices // ........................................................ @@ -751,7 +752,7 @@ public class PGraphics extends PImage implements PConstants { // not everyone needs this, but just easier to store rather // than adding another moving part to the code... vertices[vertexCount][MX] = x; - vertices[vertexCount][MY] = x; + vertices[vertexCount][MY] = y; vertexCount++; switch (shape) { diff --git a/core/PGraphics3.java b/core/PGraphics3.java index 03d4b3cae..5f6e630c2 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -1376,12 +1376,23 @@ public class PGraphics3 extends PGraphics { triangle.render(); if (raw != null) { - raw.fill(ar, ag, ab, a[A]); - raw.vertex(a[X], a[Y]); // a[X] and not a[VX] ? - raw.fill(br, bg, bb, b[A]); - raw.vertex(b[X], b[Y]); - raw.fill(cr, cg, cb, c[A]); - raw.vertex(c[X], c[Y]); + if (raw instanceof PGraphics3) { + if ((a[VW] != 0) && (b[VW] != 0) && (c[VW] != 0)) { + raw.fill(ar, ag, ab, a[A]); + raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]); + raw.fill(br, bg, bb, b[A]); + raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW]); + raw.fill(cr, cg, cb, c[A]); + raw.vertex(c[VX] / c[VW], c[VY] / c[VW], c[VZ] / c[VW]); + } + } else { + raw.fill(ar, ag, ab, a[A]); + raw.vertex(a[X], a[Y]); + raw.fill(br, bg, bb, b[A]); + raw.vertex(b[X], b[Y]); + raw.fill(cr, cg, cb, c[A]); + raw.vertex(c[X], c[Y]); + } } } @@ -1419,6 +1430,12 @@ public class PGraphics3 extends PGraphics { protected void render_lines() { + if (raw != null) { + raw.colorMode(RGB, 1); + raw.noFill(); + raw.beginShape(LINES); + } + for (int i = 0; i < lineCount; i ++) { float a[] = vertices[lines[i][VERTEX1]]; float b[] = vertices[lines[i][VERTEX2]]; @@ -1432,13 +1449,29 @@ public class PGraphics3 extends PGraphics { line.setVertices(a[X], a[Y], a[Z], b[X], b[Y], b[Z]); - //if (renderCallbackObject != null) { - //lineCallbackMethod. - //} + if (raw != null) { + if (raw instanceof PGraphics3) { + if ((a[VW] != 0) && (b[VW] != 0)) { + raw.stroke(a[SR], a[SG], a[SB], a[SA]); + raw.vertex(a[VX] / a[VW], a[VY] / a[VW], a[VZ] / a[VW]); + raw.stroke(b[SR], b[SG], b[SB], b[SA]); + raw.vertex(b[VX] / b[VW], b[VY] / b[VW], b[VZ] / b[VW]); + } + } else { + raw.stroke(a[SR], a[SG], a[SB], a[SA]); + raw.vertex(a[X], a[Y]); + raw.stroke(b[SR], b[SG], b[SB], b[SA]); + raw.vertex(b[X], b[Y]); + } + } line.setIndex(index); line.draw(); } + + if (raw != null) { + raw.endShape(); + } } @@ -3819,27 +3852,6 @@ public class PGraphics3 extends PGraphics { - ////////////////////////////////////////////////////////////// - - // RAW SHAPE RECORDING - - - /* - public void beginRaw(PGraphics raw) { - this.raw = raw; - raw.beginFrame(); - } - - - public void endRaw() { - if (raw != null) { - raw.endFrame(); - raw = null; - } - } - */ - - ////////////////////////////////////////////////////////////// // MATH (internal use only) diff --git a/core/todo.txt b/core/todo.txt index 6f723e4dc..a01e84b23 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -647,6 +647,8 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=127 PGraphicsGL +_ make a note about the anti-aliasing types in the faq +_ y may be flipped in modelX/Y/Z stuff on opengl _ opengl doesn't work in applets _ http://dev.processing.org/bugs/show_bug.cgi?id=166 _ example of getting it to work with an applet diff --git a/opengl/PGraphicsGL.java b/opengl/PGraphicsGL.java index 2fcb4efad..a7a9243cc 100644 --- a/opengl/PGraphicsGL.java +++ b/opengl/PGraphicsGL.java @@ -249,7 +249,7 @@ public class PGraphicsGL extends PGraphics3 { * because OpenGL's pixel buffer is all handled internally. */ protected void allocate() { - // changing for 0100, need to resize rather than return-allocate + // changing for 0100, need to resize rather than re-allocate canvas.setSize(width, height); } diff --git a/pdf/PGraphicsPDF.java b/pdf/PGraphicsPDF.java index 647916901..3dd377b56 100644 --- a/pdf/PGraphicsPDF.java +++ b/pdf/PGraphicsPDF.java @@ -12,7 +12,7 @@ import processing.core.*; public class PGraphicsPDF extends PGraphics2 { File temp; - int frameCount; + //int frameCount; File file; Document document; PdfWriter writer; diff --git a/todo.txt b/todo.txt index 61d45b90a..ff483a4cd 100644 --- a/todo.txt +++ b/todo.txt @@ -5,6 +5,9 @@ _ p5 not saving changes on quit, even if you say 'yes' _ http://dev.processing.org/bugs/show_bug.cgi?id=276 _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1139519266;start=;mstate=0 +_ recordRaw() to a PGraphics3 should send 3D data. +_ but recordRaw() to a PGraphics(2) should send only 2D data. + X update osx for intel binary (if necessary) _ http://developer.apple.com/qa/qa2005/qa1295.html _ find/build universal version of jogl