From 0f3930ea9555d043d358c701c58df07b4b61bb6f Mon Sep 17 00:00:00 2001 From: benfry Date: Thu, 11 May 2006 13:52:30 +0000 Subject: [PATCH] begin/endFrame become begin/endDraw.. new DXF constant.. --hide-stop param.. fix for array methods to use any kind of objects --- app/Runner.java | 2 +- build/shared/revisions.txt | 15 ++- core/PApplet.java | 199 +++++++++++++++++++++++-------------- core/PConstants.java | 2 +- core/PGraphics.java | 57 ++++++----- core/PGraphics2.java | 7 +- core/PGraphics3.java | 14 +-- core/done.txt | 28 +++++- core/todo.txt | 81 +++++++-------- dxf/RawDXF.java | 4 +- opengl/PGraphicsGL.java | 20 ++-- pdf/PGraphicsPDF.java | 14 +-- todo.txt | 57 +++++++---- 13 files changed, 296 insertions(+), 204 deletions(-) diff --git a/app/Runner.java b/app/Runner.java index bd0772ae4..2dacc926d 100644 --- a/app/Runner.java +++ b/app/Runner.java @@ -122,7 +122,7 @@ public class Runner implements MessageConsumer { params.add(PApplet.ARGS_EXTERNAL); params.add(PApplet.ARGS_PRESENT); - params.add(PApplet.ARGS_PRESENT_STOP_COLOR + "=" + + params.add(PApplet.ARGS_STOP_COLOR + "=" + Preferences.get("run.present.stop.color")); params.add(PApplet.ARGS_BGCOLOR + "=" + Preferences.get("run.present.bgcolor")); diff --git a/build/shared/revisions.txt b/build/shared/revisions.txt index 0af903ed3..56f3c6bf1 100644 --- a/build/shared/revisions.txt +++ b/build/shared/revisions.txt @@ -7,6 +7,17 @@ releases will be super crusty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . +ABOUT REV 0116 - ?? May 2006 + ++ the flag in PApplet.main() formerly called --present-stop-color + is now simply --stop-color. A flag named --hide-stop has also + been added, to prevent users from quitting out of a present mode + application. see the faq on details for capturing ESC as well. + + +. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . + + ABOUT REV 0115 - 11 May 2006 Greetings from the advanced processing workshop in the beautiful city @@ -21,7 +32,7 @@ of Barcelona. of the developer's reference: http://dev.processing.org/reference/core/javadoc/processing/core/PImage.html#save(java.lang.String) -+ loadImage() also supports image loading in the same manner, which ++ loadImage() also supports image loading in the same manner, though it's not recommended for projects that export to the web. Again, more detailed information is in the developer's reference: http://dev.processing.org/reference/core/javadoc/processing/core/PApplet.html#loadImage(java.lang.String) @@ -35,7 +46,7 @@ of Barcelona. http://dev.processing.org/bugs/show_bug.cgi?id=260 + fixed issue with beginRaw() that made the stroke of objects appear with - no translations (even though the fill was properly translated) + no transformations (even though the fill was properly transformations) http://dev.processing.org/bugs/show_bug.cgi?id=339 + removed debugging messages from loadPixels() and PGraphics2.save() diff --git a/core/PApplet.java b/core/PApplet.java index 76b4a4029..03619f035 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -376,11 +376,13 @@ public class PApplet extends Applet static public final String ARGS_DISPLAY = "--display"; - static public final String ARGS_PRESENT = "--present"; - static public final String ARGS_BGCOLOR = "--bgcolor"; - static public final String ARGS_PRESENT_STOP_COLOR = "--present-stop-color"; + static public final String ARGS_PRESENT = "--present"; + + static public final String ARGS_STOP_COLOR = "--stop-color"; + + static public final String ARGS_HIDE_STOP = "--hide-stop"; /** * Allows the user or PdeEditor to set a specific sketch folder path. @@ -436,7 +438,7 @@ public class PApplet extends Applet finished = false; // just for clarity - // this will be cleared by loop() if it is not overridden + // this will be cleared by draw() if it is not overridden looping = true; redraw = true; // draw this guy once firstMouse = true; @@ -824,7 +826,7 @@ public class PApplet extends Applet // so all that needs to be done is to set the defaults // (clear the background, set default strokeWeight, etc). //g.defaults(); - // removed this in favor of calling defaults() from beginFrame() + // removed this in favor of calling defaults() from beginDraw() // this will happen when P3D or OPENGL are used with size() // inside of setup. it's also safe to call defaults() now, @@ -1042,7 +1044,7 @@ public class PApplet extends Applet // clear things out to get started //outgoing.defaults(); - // tell people to use beginFrame/endFrame + // tell people to use beginDraw/endDraw // and send 'em off //return outgoing; @@ -1254,8 +1256,8 @@ public class PApplet extends Applet // use a different sync object //synchronized (glock) { if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 1a beginFrame"); - g.beginFrame(); + " 1a beginDraw"); + g.beginDraw(); if (THREAD_DEBUG) println(Thread.currentThread().getName() + " 1b draw"); @@ -1318,10 +1320,15 @@ public class PApplet extends Applet } else { long timeToLeave = framerateLastDelayTime + (long)(1000.0f / framerateTarget); - int napTime = - (int) (timeToLeave - System.currentTimeMillis()); - framerateLastDelayTime = timeToLeave; - delay(napTime); + long now = System.currentTimeMillis(); + int napTime = (int) (timeToLeave - now); + if (napTime > 0) { + framerateLastDelayTime = timeToLeave; + delay(napTime); + } else { + // nap time is negative, need to reset clock (bug #336) + framerateLastDelayTime = now; + } } } @@ -1365,7 +1372,7 @@ public class PApplet extends Applet dequeueKeyEvents(); if (THREAD_DEBUG) println(Thread.currentThread().getName() + - " 2b endFrame"); + " 2b endDraw"); drawMethods.handle(); //for (int i = 0; i < libraryCount; i++) { @@ -1376,17 +1383,17 @@ public class PApplet extends Applet // (only do this once draw() has run, not just setup()) } - g.endFrame(); + g.endDraw(); /* if (!recorderNull) { if (recorder != null) { - recorder.endFrame(); + recorder.endDraw(); recorder = null; } } if (!recorderRawNull) { if (g.recorderRaw != null) { - g.recorderRaw.endFrame(); + g.recorderRaw.endDraw(); g.recorderRaw = null; } } @@ -2171,7 +2178,7 @@ public class PApplet extends Applet * Grab an image of what's currently in the drawing area and save it * as a .tif or .tga file. *

- * Best used just before endFrame() at the end of your loop(). + * Best used just before endDraw() at the end of your draw(). * This can only create .tif or .tga images, so if neither extension * is specified it defaults to writing a tiff and adds a .tif suffix. */ @@ -4409,13 +4416,12 @@ public class PApplet extends Applet return b; } - /* static public Object append(Object b, Object value) { - b = expand(b, b.length + 1); - b[b.length-1] = value; + int length = Array.getLength(b); + b = expand(b, length + 1); + Array.set(b, length, value); return b; } - */ // @@ -4443,11 +4449,11 @@ public class PApplet extends Applet return contract(list, list.length-1); } - /* static public Object shorten(Object list) { - return contract(list, list.length-1); + int length = Array.getLength(list); + //Object b = Array.get(list, length - 1); + return contract(list, length - 1); } - */ // @@ -4576,6 +4582,28 @@ public class PApplet extends Applet return outgoing; } + + static final public Object splice(Object list, Object v, int index) { + Object[] outgoing = null; + int length = Array.getLength(list); + + // check whether is an array or not, and if so, treat as such + if (list.getClass().getName().charAt(0) == '[') { + int vlength = Array.getLength(v); + outgoing = new Object[length + vlength]; + System.arraycopy(list, 0, outgoing, 0, index); + System.arraycopy(v, 0, outgoing, index, vlength); + System.arraycopy(list, index, outgoing, index + vlength, length - index); + + } else { + outgoing = new Object[length + 1]; + System.arraycopy(list, 0, outgoing, 0, index); + Array.set(outgoing, index, v); + System.arraycopy(list, index, outgoing, index + 1, length - index); + } + return outgoing; + } + // static public boolean[] subset(boolean list[], int start) { @@ -4643,6 +4671,24 @@ public class PApplet extends Applet return output; } + + static public Object subset(Object list, int start) { + int length = Array.getLength(list); + int count = length - start; + Class type = list.getClass().getComponentType(); + Object outgoing = Array.newInstance(type, count); + System.arraycopy(list, 0, outgoing, 0, count); + return outgoing; + } + + static public Object subset(Object list, int start, int count) { + int length = Array.getLength(list); + Class type = list.getClass().getComponentType(); + Object outgoing = Array.newInstance(type, count); + System.arraycopy(list, start, outgoing, 0, count); + return outgoing; + } + // static public boolean[] concat(boolean a[], boolean b[]) { @@ -4687,6 +4733,16 @@ public class PApplet extends Applet return c; } + static public Object concat(Object a, Object b) { + Class type = a.getClass().getComponentType(); + int alength = Array.getLength(a); + int blength = Array.getLength(b); + Object outgoing = Array.newInstance(type, alength + blength); + System.arraycopy(a, 0, outgoing, 0, alength); + System.arraycopy(b, 0, outgoing, alength, blength); + return outgoing; + } + // static public boolean[] reverse(boolean list[]) { @@ -4743,6 +4799,16 @@ public class PApplet extends Applet return outgoing; } + static public Object reverse(Object list) { + Class type = list.getClass().getComponentType(); + int length = Array.getLength(list); + Object outgoing = Array.newInstance(type, length); + for (int i = 0; i < length; i++) { + Array.set(outgoing, i, Array.get(list, (length - 1) - i)); + } + return outgoing; + } + ////////////////////////////////////////////////////////////// @@ -5912,6 +5978,14 @@ public class PApplet extends Applet * --present put the applet into full screen presentation * mode. requires java 1.4 or later. * + * --hide-stop use to hide the stop button in situations where + * you don't want to allow users to exit. also + * see the FAQ on information for capturing the ESC + * key when running in presentation mode. + * + * --stop-color color of the 'stop' text used to quit an + * sketch when it's in present mode. + * * --bgcolor=#xxxxxx background color of the window. * * --sketch-path location of where to save files from functions @@ -5925,15 +5999,12 @@ public class PApplet extends Applet * displays are numbered starting from 1. * * - * Parameters used by Processing when running an applet externally: + * Parameters used by Processing when running via the PDE * - * --external set when the applet is being used by the PDE + * --external set when the applet is being used by the PDE * - * --editor-location=x,y position of the upper-lefthand corner of the - * editor window, for placement of applet window - * - * --present-stop-color color of the 'stop' text used to quit an - * applet when it's in present mode. + * --editor-location=x,y position of the upper-lefthand corner of the + * editor window, for placement of applet window * */ static public void main(String args[]) { @@ -5955,6 +6026,7 @@ public class PApplet extends Applet Color backgroundColor = Color.black; //BLACK; Color stopColor = Color.gray; //GRAY; GraphicsDevice displayDevice = null; + boolean hideStop = false; String param = null, value = null; @@ -5989,7 +6061,7 @@ public class PApplet extends Applet if (value.charAt(0) == '#') value = value.substring(1); backgroundColor = new Color(Integer.parseInt(value, 16)); - } else if (param.equals(ARGS_PRESENT_STOP_COLOR)) { + } else if (param.equals(ARGS_STOP_COLOR)) { if (value.charAt(0) == '#') value = value.substring(1); stopColor = new Color(Integer.parseInt(value, 16)); @@ -6004,6 +6076,9 @@ public class PApplet extends Applet if (args[argIndex].equals(ARGS_PRESENT)) { present = true; + } else if (args[argIndex].equals(ARGS_HIDE_STOP)) { + hideStop = true; + } else if (args[argIndex].equals(ARGS_EXTERNAL)) { external = true; @@ -6067,21 +6142,23 @@ public class PApplet extends Applet (fullscreen.height - applet.height) / 2, applet.width, applet.height); - Label label = new Label("stop"); - label.setForeground(stopColor); - label.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { - System.exit(0); - } - }); - frame.add(label); + if (!hideStop) { + Label label = new Label("stop"); + label.setForeground(stopColor); + label.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + System.exit(0); + } + }); + frame.add(label); - Dimension labelSize = label.getPreferredSize(); - // sometimes shows up truncated on mac - //System.out.println("label width is " + labelSize.width); - labelSize = new Dimension(100, labelSize.height); - label.setSize(labelSize); - label.setLocation(20, fullscreen.height - labelSize.height - 20); + Dimension labelSize = label.getPreferredSize(); + // sometimes shows up truncated on mac + //System.out.println("label width is " + labelSize.width); + labelSize = new Dimension(100, labelSize.height); + label.setSize(labelSize); + label.setLocation(20, fullscreen.height - labelSize.height - 20); + } // not always running externally when in present mode if (external) { @@ -6184,8 +6261,6 @@ public class PApplet extends Applet public PGraphics beginRecord(String renderer, String filename) { - //this.recorder = createGraphics(width, height, renderer, filename); - //recorder.beginFrame(); filename = insertFrame(filename); PGraphics rec = createGraphics(width, height, renderer, filename); beginRecord(rec); @@ -6195,8 +6270,7 @@ public class PApplet extends Applet public void beginRecord(PGraphics recorder) { this.recorder = recorder; - //recorder.beginRecord(); - recorder.beginFrame(); + recorder.beginDraw(); } @@ -6205,7 +6279,7 @@ public class PApplet extends Applet //if (!recorderNull) { if (recorder != null) { //recorder.endRecord(); - recorder.endFrame(); + recorder.endDraw(); recorder.dispose(); recorder = null; } @@ -6243,29 +6317,6 @@ public class PApplet extends Applet } - /* - public void beginRaw(PGraphics recorderRaw) { - g.beginRaw(recorderRaw); - } - - - public void endRaw() { - g.endRaw(); - } - */ - - /* - public void endRaw() { - //if (!recorderRawNull) { - if (g.recorderRaw != null) { - //g.recorderRaw.endFrame(); - g.endRaw(); - g.recorderRaw = null; - } - } - */ - - ////////////////////////////////////////////////////////////// diff --git a/core/PConstants.java b/core/PConstants.java index 7e8a54749..eac4b8b62 100644 --- a/core/PConstants.java +++ b/core/PConstants.java @@ -44,7 +44,7 @@ public interface PConstants { static final String JAVA2D = "processing.core.PGraphics2"; static final String OPENGL = "processing.opengl.PGraphicsGL"; static final String PDF = "processing.pdf.PGraphicsPDF"; - //static final String DXF = "processing.dxf.RawDXF"; + static final String DXF = "processing.dxf.RawDXF"; //static final String SVG = "processing.dxf.PGraphicsSVG"; diff --git a/core/PGraphics.java b/core/PGraphics.java index 4c78629dc..19e34d981 100644 --- a/core/PGraphics.java +++ b/core/PGraphics.java @@ -328,8 +328,7 @@ public class PGraphics extends PImage implements PConstants { public PMatrix modelviewInv; /** - * The camera matrix, the modelview - * will be set to this on beginFrame. + * The camera matrix, the modelview will be set to this on beginDraw. */ public PMatrix camera; @@ -564,16 +563,36 @@ public class PGraphics extends PImage implements PConstants { // FRAME + /** + * Former function, now called beginDraw. + * @deprecated + */ + public void beginFrame() { // ignore + System.err.println("beginFrame() is now beginDraw(), please use that instead"); + beginDraw(); + } + + + /** + * Former function, now called endDraw. + * @deprecated + */ + public void endFrame() { // ignore + System.err.println("endFrame() is now endDraw(), please use that instead"); + endDraw(); + } + + /** * Prepares the PGraphics for drawing. *

* When creating your own PGraphics, you should call this before * drawing anything. */ - public void beginFrame() { // ignore + public void beginDraw() { // ignore // need to call defaults(), but can only be done when it's ok // to draw (i.e. for opengl, no drawing can be done outside - // beginFrame/endFrame). + // beginDraw/endDraw). if (!defaultsInited) defaults(); resetMatrix(); // reset model matrix @@ -589,7 +608,7 @@ public class PGraphics extends PImage implements PConstants { * When creating your own PGraphics, you should call this when * you're finished drawing. */ - public void endFrame() { // ignore + public void endDraw() { // ignore // moving this back here (post-68) because of macosx thread problem if (mis != null) { mis.newPixels(pixels, cm, 0, width); @@ -3557,21 +3576,9 @@ public class PGraphics extends PImage implements PConstants { ////////////////////////////////////////////////////////////// - /* - public void beginRecord() { // ignore - beginFrame(); // default is just to open the frame - } - - - public void endRecord() { // ignore - endFrame(); - } - */ - - public void beginRaw(PGraphics raw) { this.raw = raw; - raw.beginFrame(); + raw.beginDraw(); } @@ -3580,9 +3587,9 @@ public class PGraphics extends PImage implements PConstants { // for 3D, need to flush any geometry that's been stored for sorting raw.flush(); - // just like beginFrame, this will have to be called because - // endFrame() will be happening outside of draw() - raw.endFrame(); + // just like beginDraw, this will have to be called because + // endDraw() will be happening outside of draw() + raw.endDraw(); raw.dispose(); raw = null; } @@ -3610,12 +3617,4 @@ public class PGraphics extends PImage implements PConstants { public boolean displayable() { return true; } - - //public void beginRaw() { // ignore - //beginFrame(); - //} - - //public void endRaw() { // ignore - //endFrame(); - //} } diff --git a/core/PGraphics2.java b/core/PGraphics2.java index 5c0871060..b73aedda9 100644 --- a/core/PGraphics2.java +++ b/core/PGraphics2.java @@ -117,7 +117,7 @@ public class PGraphics2 extends PGraphics { // turn off mis.newPixels - public void endFrame() { + public void endDraw() { // moving this back here (post-68) because of macosx thread problem //mis.newPixels(pixels, cm, 0, width); @@ -929,8 +929,13 @@ public class PGraphics2 extends PGraphics { public void clear() { + // in case people do transformations before background(), + // need to handle this with a push/reset/pop + pushMatrix(); + resetMatrix(); g2.setColor(new Color(backgroundColor)); g2.fillRect(0, 0, width, height); + popMatrix(); } diff --git a/core/PGraphics3.java b/core/PGraphics3.java index 7cf8aa87b..b736f9500 100644 --- a/core/PGraphics3.java +++ b/core/PGraphics3.java @@ -88,7 +88,7 @@ public class PGraphics3 extends PGraphics { // i think vertex_end is actually the last vertex in the current shape // and is separate from vertexCount for occasions where drawing happens - // on endFrame with all the triangles being depth sorted + // on endDraw() with all the triangles being depth sorted protected int vertex_end; // vertices may be added during clipping against the near plane. @@ -302,8 +302,8 @@ public class PGraphics3 extends PGraphics { } - public void beginFrame() { - super.beginFrame(); + public void beginDraw() { + super.beginDraw(); modelview.set(camera); modelviewInv.set(cameraInv); @@ -339,7 +339,7 @@ public class PGraphics3 extends PGraphics { * all be quicksorted here (to make alpha work more properly) * and then blit to the screen. */ - public void endFrame() { + public void endDraw() { // no need to z order and render // shapes were already rendered in endShape(); // (but can't return, since needs to update memimgsrc @@ -347,7 +347,7 @@ public class PGraphics3 extends PGraphics { flush(); } // blit to screen - super.endFrame(); + super.endDraw(); } @@ -401,7 +401,7 @@ public class PGraphics3 extends PGraphics { if (hints[ENABLE_DEPTH_SORT]) { // continue with previous vertex, line and triangle count - // all shapes are rendered at endFrame(); + // all shapes are rendered at endDraw(); vertex_start = vertexCount; vertex_end = 0; @@ -1053,7 +1053,7 @@ public class PGraphics3 extends PGraphics { // ------------------------------------------------------------------ // RENDER SHAPES FILLS HERE WHEN NOT DEPTH SORTING - // if true, the shapes will be rendered on endFrame + // if true, the shapes will be rendered on endDraw if (!hints[ENABLE_DEPTH_SORT]) { if (fill) render_triangles(); if (stroke) render_lines(); diff --git a/core/done.txt b/core/done.txt index 667465645..a29d89950 100644 --- a/core/done.txt +++ b/core/done.txt @@ -37,13 +37,8 @@ X fix for open() on macosx submitted by chandler 0112 core -o PSound.play() won't play the sound a 2nd time (reopened) -o http://dev.processing.org/bugs/show_bug.cgi?id=208 -o loadSound apparently broken in java 1.5? -o http://dev.processing.org/bugs/show_bug.cgi?id=285 X saveFrame() issues with JAVA2D on osx X http://dev.processing.org/bugs/show_bug.cgi?id=189 -X need to just remove PSound altogether o implement hint(NO_DEPTH_TEST) for opengl X already done hint(DISABLE_DEPTH_TEXT); X check min/max texture sizes when binding to avoid problems @@ -68,6 +63,29 @@ X was using apply() instead of set() in PMatrix inverse copy X filter() is also broken (not rewinding the intbuffer) X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_3DOpenGL;action=display;num=1144561113 +sound has been removed +o duration as an internal param, not a function +o When a sound is finished playing, +o it should return to 0 so it can play again +o Putting sound.loop() in draw() seemed to spawn multiple sounds threads? +o After a sound is paused, it will only play from where it was paused +o to its end and will not loop again +o The ref in PSound2 says volume accepts vals from 0...1 +o but values larger than one increase the volume. +o SoundEvent // is sound finished?? Can't access now. +o make java 1.1 version of PSound work properly +o merge PSound and PSound2 via reflection? +o once debugged, merge these back together and use reflection +o (unless it's a messy disaster) +o Unsupported control type: Master Gain +o what's actually causing this error? +o http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115467831 +o PSound.play() won't play the sound a 2nd time (reopened) +o http://dev.processing.org/bugs/show_bug.cgi?id=208 +o loadSound apparently broken in java 1.5? +o http://dev.processing.org/bugs/show_bug.cgi?id=285 +X need to just remove PSound altogether + 0111 core X need to have a better way of getting/figuring out the endian diff --git a/core/todo.txt b/core/todo.txt index 1661e6778..0256793aa 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,14 +1,34 @@ 0116 core -_ endRaw() should force depth sorted triangles to flush +X make background() ignore transformations in JAVA2D +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1147010374 +o createGraphics to not require defaults() +X can't do, because an end() function must be called to clear the renderer +X add "hide stop button" arg for PApplet +X beginFrame/endFrame -> beginDraw/endDraw +X add new constant for the DXF renderer +X array utilities on Object[] are worthless.. fix it with reflection? +X see if reflection will allow expand for all class types +X expand, append, contract, subset, splice, concat, reverse +X typed version of array functions: +X append(), shorten(), splice, slice, subset, concat, reverse +X http://dev.processing.org/bugs/show_bug.cgi?id=115 +X fix issue where processing applets would run extremely fast +X after having been starved of resources where there framerate dropped +X http://dev.processing.org/bugs/show_bug.cgi?id=336 + + +0117 core +_ bring back the old P2D, rename PGraphics2 into PGraphicsJava + + +_ endRaw() is a problem with hint(ENABLE_DEPTH_SORT) +_ because the triangles won't be rendered by the time endRaw() is called +_ force depth sorted triangles to flush _ fix dxf export bug _ fix erik's problems with export (also in bugs db) - _ an image marked RGB but with 0s for the alpha won't draw in JAVA2D -_ illegal jpeg images are what happens whenever the image cannot be read -_ java.lang.IllegalArgumentException: Width (-1) and height (-1) cannot be <= 0 -_ for instance, trying to load a tiff image with the jpg loader _ test support for reading and writing images that have alpha and imageio @@ -20,14 +40,13 @@ colorMode(RGB, 100); background(128); -0117 core -_ bring back the old P2D, rename PGraphics2 into PGraphicsJava - _ opengl keeping memory around.. _ could this be in vertices that have an image associated _ or the image buffer used for textures _ that never gets cleared fully? +_ resizing opengl applet likely to cause big trouble +_ componentlistener should prolly only do size() command outside of draw _ make the opengl textmode shape stuff get better and use PShape @@ -40,12 +59,10 @@ _ textMode(SHAPE) faster in opengl _ cache for tyhpe should be per-renderer _ because opengl needs vectors, but also the image cache for textures -_ createGraphics to not require defaults() _ how to clear the screen with alpha? background(0, 0, 0, 0)? _ background(EMPTY) -> background(0x01000000) or something? _ remove POLYGON, LINE_LOOP, LINE_STRIP -_ beginFrame/endFrame -> beginDraw/endDraw _ begin/endPixels.. _ on PImage, sets a flag that marks it to be updated on next render _ for PImage, begin after an end is ignored, no pixels are re-loaded @@ -75,8 +92,6 @@ _ color values on camera input flipped on intel macs X checked in a change for this recommended on qtjava list _ http://dev.processing.org/bugs/show_bug.cgi?id=313 -_ endRaw() is a problem with hint(ENABLE_DEPTH_SORT) -_ because the triangles won't be rendered by the time endRaw() is called _ need to merge sorting/drawing of lines and triangles _ lines will occlude tris and vice versa _ will need to split each based on the other @@ -120,12 +135,6 @@ _ however this is a necessity, otherwise nasty flickering ensues _ and using a "glock" object seems to completely deadlock _ http://dev.processing.org/bugs/show_bug.cgi?id=46 -_ loadImage(url) having trouble with jpeg -_ actually it's an issue with some types of jpeg files -_ http://dev.processing.org/bugs/show_bug.cgi?id=279 -_ png image loading problems -_ http://dev.processing.org/bugs/show_bug.cgi?id=305 - _ when an exception comes through during cameraEvent, not printed _ need to show an actual stack trace (InvocationTargetEx) _ because otherwise it's impossible to debug this stuff @@ -314,9 +323,6 @@ The graphics library was formerly called Bagel. CORE / PApplet -_ typed version of array functions: -_ append(), shorten(), splice, slice, subset, concat, reverse -_ http://dev.processing.org/bugs/show_bug.cgi?id=115 _ would be cool if could sort w/o the sort class.. _ meaning use reflection to sort objects, just by implementing a few methods _ would be much simpler and less confusing than new Sort() etc @@ -352,8 +358,6 @@ _ delay might be a good way to signal drawing to the screen/updating _ catch security exceptions around applet i/o calls _ not just for saving files, but provide better error msgs when _ attempting to download from another server -_ array utilities on Object[] are worthless.. fix it with reflection? -_ see if reflection will allow expand for all class types _ ed's thread re: fullscreen strategies _ could add a new BApplet that uses BufferStrategy? _ http://processing.org/discourse/yabb/YaBB.cgi?board=Programs;action=display;num=1081335361;start=15 @@ -450,6 +454,8 @@ _ and then does 5 step sizes for each curveto CORE / PGraphics +_ have createGraphics() create a completely transparent image +_ and also not require defaults() to be called _ point() doesn't work with some graphics card setups _ particularly with opengl and java2d _ http://dev.processing.org/bugs/show_bug.cgi?id=121 @@ -653,6 +659,15 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=103 CORE / PImage +_ loadImage(url) having trouble with jpeg +_ actually it's an issue with some types of jpeg files +_ http://dev.processing.org/bugs/show_bug.cgi?id=279 +_ java.lang.IllegalArgumentException: +_ Width (-1) and height (-1) cannot be <= 0 +_ identical to what happens when the image data is bad +_ for instance, trying to load a tiff image with the jpg loader +_ png image loading problems +_ http://dev.processing.org/bugs/show_bug.cgi?id=305 _ don't grab pixels of java2d images unless asked _ this is the difference between a lot of loadPixels() and not _ so important to have it in before beta if that's the change @@ -673,26 +688,6 @@ _ loadImage() using spaces in the name _ if loadImage() with spaces when online(), throw an error -CORE / PSound - -_ duration as an internal param, not a function -_ When a sound is finished playing, -_ it should return to 0 so it can play again -_ Putting sound.loop() in draw() seemed to spawn multiple sounds threads? -_ After a sound is paused, it will only play from where it was paused -_ to its end and will not loop again -_ The ref in PSound2 says volume accepts vals from 0...1 -_ but values larger than one increase the volume. -_ SoundEvent // is sound finished?? Can't access now. -_ make java 1.1 version of PSound work properly -_ merge PSound and PSound2 via reflection? -_ once debugged, merge these back together and use reflection -_ (unless it's a messy disaster) -_ Unsupported control type: Master Gain -_ what's actually causing this error? -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115467831 - - CORE / Documentation _ write documentation on general use of processing.core diff --git a/dxf/RawDXF.java b/dxf/RawDXF.java index ff472340d..758af95c9 100644 --- a/dxf/RawDXF.java +++ b/dxf/RawDXF.java @@ -59,7 +59,7 @@ import processing.core.*; * * void draw() { * if (record) { - * beginRaw("processing.dxf.RawDXF", "output.dxf"); + * beginRaw(DXF, "output.dxf"); * } * * // do all your drawing here @@ -88,7 +88,7 @@ import processing.core.*; * * void draw() { * if (record) { - * dxf = (RawDXF) createGraphics("processing.dxf.RawDXF", "output.dxf"); + * dxf = (RawDXF) createGraphics(DXF, "output.dxf"); * beginRaw(dxf); * } * diff --git a/opengl/PGraphicsGL.java b/opengl/PGraphicsGL.java index 80f508242..6acb87e25 100644 --- a/opengl/PGraphicsGL.java +++ b/opengl/PGraphicsGL.java @@ -307,10 +307,10 @@ public class PGraphicsGL extends PGraphics3 { */ - public void beginFrame() { - super.beginFrame(); + public void beginDraw() { + super.beginDraw(); - report("top beginFrame()"); + report("top beginDraw()"); gl.glDisable(GL.GL_LIGHTING); for (int i = 0; i < MAX_LIGHTS; i++) { @@ -390,22 +390,22 @@ public class PGraphicsGL extends PGraphics3 { //gl.glEnable(GL.GL_RESCALE_NORMAL); //gl.GlLightModeli(GL.GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR); - report("bot beginFrame()"); + report("bot beginDraw()"); // are there other things to do here? - //System.out.println("beginFrame() stop error " + PApplet.hex(gl.glGetError())); + //System.out.println("beginDraw() stop error " + PApplet.hex(gl.glGetError())); } - public void endFrame() { - //System.out.println("endFrame() error " + PApplet.hex(gl.glGetError())); + public void endDraw() { + //System.out.println("endDraw() error " + PApplet.hex(gl.glGetError())); - report("top endFrame()"); + report("top endDraw()"); if (hints[ENABLE_DEPTH_SORT]) { flush(); } - report("bot endFrame()"); + report("bot endDraw()"); } @@ -413,7 +413,7 @@ public class PGraphicsGL extends PGraphics3 { // this would also need to set up the lighting.. ? public GL beginGL() { - //beginFrame(); // frame will have already started + //beginDraw(); // frame will have already started gl.glPushMatrix(); // load p5 modelview into the opengl modelview diff --git a/pdf/PGraphicsPDF.java b/pdf/PGraphicsPDF.java index 28b3842e3..e351fb50e 100644 --- a/pdf/PGraphicsPDF.java +++ b/pdf/PGraphicsPDF.java @@ -121,10 +121,10 @@ public class PGraphicsPDF extends PGraphics2 { } */ - public void beginFrame() { + public void beginDraw() { // temporary //file = new File(filename); //"test.pdf"); - //System.out.println("pdf beginFrame()"); + //System.out.println("pdf beginDraw()"); //document = new Document(); if (document == null) { @@ -141,7 +141,7 @@ public class PGraphicsPDF extends PGraphics2 { // how to call newPage() in here? /* - System.out.println("beginFrame() " + width + ", " + height); + System.out.println("beginDraw() " + width + ", " + height); tp = content.createTemplate(width, height); //g2 = tp.createGraphics(width, height, mapper); g2 = tp.createGraphicsShapes(width, height); @@ -156,7 +156,7 @@ public class PGraphicsPDF extends PGraphics2 { //g2 = content.createGraphics(width, height); g2 = content.createGraphicsShapes(width, height); } - super.beginFrame(); + super.beginDraw(); } @@ -180,12 +180,12 @@ public class PGraphicsPDF extends PGraphics2 { } g2 = content.createGraphicsShapes(width, height); - // should there be a beginFrame/endFrame in here? + // should there be a beginDraw/endDraw in here? } - public void endFrame() { - //System.out.println("endFrame()"); + public void endDraw() { + //System.out.println("endDraw()"); /* String text1 = "This text has \u0634\u0627\u062f\u062c\u0645\u0647\u0648\u0631 123,456 \u0645\u0646 (Arabic)"; diff --git a/todo.txt b/todo.txt index 50ea1264c..82a1ffff8 100644 --- a/todo.txt +++ b/todo.txt @@ -1,12 +1,45 @@ 0116 pde -_ toInt() needs to go away in time for the book.. fix parser bugs -_ make expand() et al work on objects +_ size of sketch different in setup() and draw() on linux +_ make sure that the sketch isn't being sized based on bad insets +_ http://dev.processing.org/bugs/show_bug.cgi?id=341 +text faq +_ how to use textMode(SHAPES) with opengl +_ things will be extremely slow (fix later) +_ things will also be very ugly on-screen +_ text being nicer in java2d +_ use createFont() to load the font or use a font from your machine +_ note that createFont() is no good for applets/export to web +_ textMode(SCREEN) for P2D and P3D for nice fast text in screen space +_ currently slow in JAVA2D and OPENGL, but this will improve + +the only way to do it (this will improve later) is to use some undocumented features +1) you have to use the OPENGL renderer +2) use textMode(SHAPE); +3) use createFont() (which you already are) +this will convert all the shape data from the fonts for writing. it will be *extremely* slow, which is part of why it's not documented yet. but it will work with beginRaw(). + +advanced faq +X advanced reference contains more info about how things work +X move 'how do i create large images' here +_ move stuff about getting gl object and java2d stuff here +_ explain how to integrate code with swing +_ use a separate environment, call init(), use noLoop(), redraw() +_ how do i add gui to a sketch? +_ don't use awt components +X createGraphics with PDF, using dispose() to clear the thing +X calling nextPage() _ notes about setting key=0 to catch ESC _ also size(screen.width, screen.height); _ maybe make a section in installations with p5 +_ clean up the notes in the faq about how to get video to work +_ make the instructions for winvdig clearer + +_ toInt() needs to go away in time for the book.. fix parser bugs +_ make expand() et al work on objects + _ would be nice to have macosx packaged up as a single .app file _ should recommend that people install libraries into their sketchbook @@ -22,8 +55,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=321 _ stop button won't kill a video sketch (bug 150 example does this) _ run/stop button highlight is almost completely broken -_ add "hide stop button" arg for PApplet - board stuff _ only allow moderators to delete posts _ set "no smileys" as the default for posting code @@ -133,24 +164,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=255 _ bug duplicate text field doesn't retain focus _ http://dev.processing.org/bugs/show_bug.cgi?id=256 -text faq -_ how to use textMode(SHAPES) with opengl -_ things will be extremely slow (fix later) -_ things will also be very ugly on-screen -_ text being nicer in java2d -_ textMode(SCREEN) for P2D and P3D for nice fast text - -advanced faq -_ move 'how do i create large images' here -_ move stuff about getting gl object and java2d stuff here -_ explain how to integrate code with swing -_ use a separate environment, call init(), use noLoop(), redraw() -_ how do i add gui to a sketch? -_ don't use awt components -_ advanced reference contains more info about how things work -_ createGraphics with PDF, using dispose() to clear the thing -_ calling nextPage() - board faq _ someone wrote up an initial version of this _ how to put [code] around blocks of code