diff --git a/core/src/processing/core/PApplet.java b/core/src/processing/core/PApplet.java index debf86ebe..23b871c36 100644 --- a/core/src/processing/core/PApplet.java +++ b/core/src/processing/core/PApplet.java @@ -208,7 +208,7 @@ public class PApplet extends Applet * when the renderer is changed. This is the only way for us to handle * invoking the new renderer while also in the midst of rendering. */ - static final String NEW_RENDERER = "new renderer"; + static public final String NEW_RENDERER = "new renderer"; /** Renderer to use next time the component is updated */ //String nextRenderer = JAVA2D; @@ -2693,13 +2693,6 @@ in */ System.out.flush(); } - /* - static public void print(double what) { - System.out.print(what); - System.out.flush(); - } - */ - static public void print(String what) { System.out.print(what); System.out.flush(); @@ -2818,12 +2811,6 @@ in */ print(what); System.out.println(); } - /* - static public void println(double what) { - print(what); System.out.println(); - } - */ - static public void println(String what) { print(what); System.out.println(); } diff --git a/core/src/processing/core/PConstants.java b/core/src/processing/core/PConstants.java index f5e7d9bed..d0995df81 100644 --- a/core/src/processing/core/PConstants.java +++ b/core/src/processing/core/PConstants.java @@ -327,19 +327,15 @@ public interface PConstants { // hints - //static final int SCALE_STROKE_WIDTH = 0; - //static final int LIGHTING_AFFECTS_STROKE = 1; + static final int ENABLE_OPENGL_2X_SMOOTH = 0; + static final int ENABLE_OPENGL_4X_SMOOTH = 1; static final int ENABLE_NATIVE_FONTS = 2; - static final int DISABLE_TEXT_SMOOTH = 3; - //static final int DISABLE_SMOOTH_HACK = 4; static final int DISABLE_DEPTH_TEST = 5; static final int DISABLE_FLYING_POO = 6; static final int ENABLE_DEPTH_SORT = 7; static final int DISABLE_ERROR_REPORT = 8; static final int ENABLE_ACCURATE_TEXTURES = 9; static final int DISABLE_AUTO_GZIP = 10; - static final int ENABLE_OPENGL_2X_SMOOTH = 11; - static final int ENABLE_OPENGL_4X_SMOOTH = 12; - static final int HINT_COUNT = 13; + static final int HINT_COUNT = 11; } diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 0f58ac8b2..4eac7f4a5 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -192,15 +192,15 @@ public abstract class PGraphics extends PImage implements PConstants { // ........................................................ /** - * Array of hint[] items. These are hacks to get around various - * temporary workarounds inside the environment. + * Array of hint[] items. These are hacks to get around various + * temporary workarounds inside the environment. *
- * Note that this array cannot be static, as a hint() may result in a + * Note that this array cannot be static, as a hint() may result in a * runtime change specific to a renderer. For instance, calling - * hint(DISABLE_DEPTH_TEST) has to call glDisable() right away on an + * hint(DISABLE_DEPTH_TEST) has to call glDisable() right away on an * instance of PGraphicsOpenGL. * - * The hints[] array is allocated early on because it might + * The hints[] array is allocated early on because it might * be used inside beginDraw(), allocate(), etc. */ protected boolean hints[] = new boolean[HINT_COUNT]; diff --git a/core/src/processing/core/PGraphics3D.java b/core/src/processing/core/PGraphics3D.java index ecb511817..aa29baa08 100644 --- a/core/src/processing/core/PGraphics3D.java +++ b/core/src/processing/core/PGraphics3D.java @@ -309,7 +309,7 @@ public class PGraphics3D extends PGraphics { if (mainDrawingSurface) { //for (int i = 0; i < pixelCount; i++) pixels[i] = backgroundColor; - // Not necessary because background() will be called w/ defaults(), + // Not necessary because background() will be called w/ defaults(), // and we're no longer subject to the Java 1.1 bug for transparent // pixels in MemoryImageSource. //Arrays.fill(pixels, backgroundColor); diff --git a/core/src/processing/core/PPolygon.java b/core/src/processing/core/PPolygon.java index 02d442f77..62c1d5b18 100644 --- a/core/src/processing/core/PPolygon.java +++ b/core/src/processing/core/PPolygon.java @@ -200,8 +200,7 @@ public class PPolygon implements PConstants { // by default, text turns on smooth for the textures // themselves. but this should be shut off if the hint // for DISABLE_TEXT_SMOOTH is set. - texture_smooth = (//parent.drawing_text && - !parent.hints[DISABLE_TEXT_SMOOTH]); + texture_smooth = true; width = smooth ? parent.width*SUBXRES : parent.width; height = smooth ? parent.height*SUBYRES : parent.height; diff --git a/core/todo.txt b/core/todo.txt index 586dd11c7..da1b38ed7 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,8 +1,28 @@ 0131 core X hint(DISABLE_DEPTH_TEST) not behaving consistently X http://dev.processing.org/bugs/show_bug.cgi?id=483 -X make hints static +o make hints static - cannot do that +X clean up hinting mechanism a bit +X look into jogl anti-aliasing on osx +o smoothMode(2) and smoothMode(4), right after size()? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1175552759 +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1164236069 +X look into capabilities stuff from mike creighton +X also sets the aa mode on the pc so it no longer needs control panel bunk +X update to JOGL 1.1.0 +X add gluegen-rt back to the applet export +X http://download.java.net/media/jogl/builds/nightly/javadoc_public/com/sun/opengl/util/JOGLAppletLauncher.html +X add print() and println() for long and double +X http://dev.processing.org/bugs/show_bug.cgi?id=652 +cleaning +X "this file is named" errors don't like subdirectories +X need to strip off past the file separator or something + +_ fix svg caps/joins for opengl with svg library +_ http://dev.processing.org/bugs/show_bug.cgi?id=628 +_ key and mouse events delivered out of order +_ http://dev.processing.org/bugs/show_bug.cgi?id=638 _ add warning system for pgraphics, rather than runtime exceptions _ keep array of warning strings, and booleans for whether they've called @@ -81,10 +101,6 @@ _ is fill() not coloring textures properly? _ don't need to apply tint() to textures, supposed to use fill color Hope this helps: If you haven't tracked it down yet... it's in PTriangle, when a flat-shaded textured triangle is drawn, then the rgb of the tint isn't used. So, for example, if the triangle renderer branches to drawsegment_texture32() the tint rgb won't be used, whereas if it branches to drawsegment_gouraud_texture32() then the tint rgb WILL be used. Alpha gets used from tint, because all alpha has to do is be != 255, but for rgb to get used they values have to differ among vertices (which won't happen via the image() routine for example). The quick fix might be to insert an additional test in setIntensities() to check if parent.tint is true, and if so then force gouraud shading, INTERPOLATE_RGB=true. - -_ key and mouse events delivered out of order -_ http://dev.processing.org/bugs/show_bug.cgi?id=638 - rework some text/font code _ fix getFontMetrics() warning _ Java2D textLinePlacedImpl should check for ENABLE_NATIVE_FONTS hint @@ -93,17 +109,6 @@ _ also try to check native font on textFont() commands _ in case the hint() has been enabled in the meantime _ or rather, always load native font, even w/o the hint() being set -_ fix svg caps/joins for opengl with svg library -_ http://dev.processing.org/bugs/show_bug.cgi?id=628 -_ add gluegen-rt back to the applet export -_ http://download.java.net/media/jogl/builds/nightly/javadoc_public/com/sun/opengl/util/JOGLAppletLauncher.html -_ look into jogl anti-aliasing on osx -_ smoothMode(2) and smoothMode(4), right after size()? -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1175552759 -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=OpenGL;action=display;num=1164236069 -_ look into capabilities stuff from mike creighton -_ also sets the aa mode on the pc so it no longer needs control panel bunk - _ loadBytes() and saveStream() functions badly need optimization! _ don't bother using a buffering stream, just handle internally. gah! @@ -132,8 +137,6 @@ _ probably rounding error with the images _ http://dev.processing.org/bugs/show_bug.cgi?id=475 should be fixed, but needs to be tested -_ "this file is named" errors don't like subdirectories -_ need to strip off past the file separator or something _ figure out why 1024x768 image takes 3.5 seconds to load _ would using a BufferedImage work better? _ is the image actually a BufferedImage so PixelGrabber is a waste? @@ -196,6 +199,8 @@ _ sketches lock up when system time is changed _ http://dev.processing.org/bugs/show_bug.cgi?id=639 point() +_ java2d - if strokeWeight is 1, do screenX/Y and set() +_ if strokeWeight larger, should work ok with line() _ gl points not working again _ need to implement point() as actual gl points _ this means adding points to the pipeline diff --git a/opengl/src/processing/opengl/PGraphicsOpenGL.java b/opengl/src/processing/opengl/PGraphicsOpenGL.java index 3d9c91945..a0507b774 100644 --- a/opengl/src/processing/opengl/PGraphicsOpenGL.java +++ b/opengl/src/processing/opengl/PGraphicsOpenGL.java @@ -209,16 +209,14 @@ public class PGraphicsOpenGL extends PGraphics3D { protected void allocate() { if (canvas == null) { GLCapabilities capabilities = new GLCapabilities(); - if (hints[ENABLE_OPENGL_2X_SMOOTH]) { - capabilities.setSampleBuffers(true); - capabilities.setNumSamples(2); + if (hints[ENABLE_OPENGL_2X_SMOOTH]) { + capabilities.setSampleBuffers(true); + capabilities.setNumSamples(2); } else if (hints[ENABLE_OPENGL_4X_SMOOTH]) { capabilities.setSampleBuffers(true); capabilities.setNumSamples(4); } - //canvas = new GLCanvas(); - canvas = new GLCanvas(capabilities); - + canvas = new GLCanvas(capabilities); //System.out.println("creating PGraphicsOpenGL 3"); canvas.addGLEventListener(new GLEventListener() { @@ -299,10 +297,31 @@ public class PGraphicsOpenGL extends PGraphics3D { public void hint(int which) { + // make note of whether these are set, if they are, + // then will prevent the new renderer exception from being thrown. + boolean opengl2X = hints[ENABLE_OPENGL_2X_SMOOTH]; + boolean opengl4X = hints[ENABLE_OPENGL_4X_SMOOTH]; super.hint(which); if (which == DISABLE_DEPTH_TEST) { gl.glDisable(GL.GL_DEPTH_TEST); + + } else if (which == ENABLE_OPENGL_2X_SMOOTH) { + if (!opengl2X) { + parent.remove(canvas); + //canvas.setLocation(width, 0); + canvas = null; + allocate(); + throw new RuntimeException(PApplet.NEW_RENDERER); + } + } else if (which == ENABLE_OPENGL_4X_SMOOTH) { + if (!opengl4X) { + //canvas.setLocation(width, 0); + parent.remove(canvas); + canvas = null; + allocate(); + throw new RuntimeException(PApplet.NEW_RENDERER); + } } } @@ -487,6 +506,9 @@ public class PGraphicsOpenGL extends PGraphics3D { float a[] = vertices[triangles[i][VERTEX1]]; float b[] = vertices[triangles[i][VERTEX2]]; float c[] = vertices[triangles[i][VERTEX3]]; + //System.out.println(triangles[i][VERTEX1] + " " + + // triangles[i][VERTEX2] + " " + + // triangles[i][VERTEX3] + " " + vertexCount); // This is only true when not textured. We really should pass SPECULAR // straight through to triangle rendering. @@ -587,16 +609,19 @@ public class PGraphicsOpenGL extends PGraphics3D { gl.glColor4f(ar, ag, ab, a[A]); gl.glTexCoord2f(a[U] * uscale, a[V] * vscale); gl.glNormal3f(a[NX], a[NY], a[NZ]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(a[VX], a[VY], a[VZ]); gl.glColor4f(br, bg, bb, b[A]); gl.glTexCoord2f(b[U] * uscale, b[V] * vscale); gl.glNormal3f(b[NX], b[NY], b[NZ]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(b[VX], b[VY], b[VZ]); gl.glColor4f(cr, cg, cb, c[A]); gl.glTexCoord2f(c[U] * uscale, c[V] * vscale); gl.glNormal3f(c[NX], c[NY], c[NZ]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(c[VX], c[VY], c[VZ]); gl.glEnd(); @@ -641,14 +666,17 @@ public class PGraphicsOpenGL extends PGraphics3D { gl.glColor4f(ar, ag, ab, a[A]); gl.glNormal3f(a[NX], a[NY], a[NZ]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(a[VX], a[VY], a[VZ]); gl.glColor4f(br, bg, bb, b[A]); gl.glNormal3f(b[NX], b[NY], b[NZ]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(b[VX], b[VY], b[VZ]); gl.glColor4f(cr, cg, cb, c[A]); gl.glNormal3f(c[NX], c[NY], c[NZ]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(c[VX], c[VY], c[VZ]); if (raw != null) { @@ -746,6 +774,7 @@ public class PGraphicsOpenGL extends PGraphics3D { // always draw a first point float a[] = vertices[lines[i][VERTEX1]]; gl.glColor4f(a[SR], a[SG], a[SB], a[SA]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(a[VX], a[VY], a[VZ]); //System.out.println("First point: " + a[VX] +", "+ a[VY] +", "+ a[VZ]); @@ -771,6 +800,7 @@ public class PGraphicsOpenGL extends PGraphics3D { for (int k = 0; k < pathLength[j]; k++) { float b[] = vertices[lines[i][VERTEX2]]; gl.glColor4f(b[SR], b[SG], b[SB], b[SA]); + //gl.glEdgeFlag(a[EDGE] == 1); gl.glVertex3f(b[VX], b[VY], b[VZ]); if (raw != null) { if (raw instanceof PGraphics3D) { @@ -1341,6 +1371,10 @@ public class PGraphicsOpenGL extends PGraphics3D { endShape(); } +// public void edge(boolean e) { +// PGraphicsOpenGL.this.edge(e); +// } + public void vertex(Object data) { if (data instanceof double[]) { double[] d = (double[]) data; diff --git a/todo.txt b/todo.txt index 2f4952b09..9534fa16b 100644 --- a/todo.txt +++ b/todo.txt @@ -2,6 +2,8 @@ o make loadFont() work properly with regular fonts? X no, because some renderers really need to create, not load it X would have to cache opengl fonts at different sizes, etc +X document hint() commands for advanced reference +X add note about gcj/gij to the platform notes server/client stuff X add server/client notification thing for the nyu guys @@ -58,7 +60,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=584 _ can't get documents/prefs folder on vista _ http://dev.processing.org/bugs/show_bug.cgi?id=585 -_ remove 'patch' designation from bugzilla _ ocd is broken in 0125 - do a better error message for this _ disallow .java tabs with same name as the sketch @@ -1126,7 +1127,6 @@ _ need more comprehensive list of 'known bugs' _ need more comprehensive list of 'known suggestions' _ javadoc "advanced" reference by beta _ and then finalizing it towards 1.0 -_ document hint() commands for advanced reference _ write notes about running p5 on another platforms _ this was some feedback from running on bsd: _ /usr/local/jdk1.3.1/bin/java -cp lib:lib/build:lib/pde.jar:lib/kjc.jar:lib/oro.jar:java/lib/ext/comm.jar PdeBase