Changes

From Processing

Jump to: navigation, search

Contents

This used to work and now it doesn't

The Processing Language changes as the software evolves. Some of the most important changes are presented on this page. For each release, read the revisions.txt file (included with the download) to see what's changed since the release before it. This is where you go if your code stops working in the most recent release, or if you want to know if your favorite bug has been fixed. If you don't want to download first, you can read the most recent version here.

Upcoming changes in Processing 2.0 (revision 0198+)

As of June 18, 2011, we're making major changes in advance of Processing 2.0, which we would like to release in late summer or early fall. As a result of these changes, using current builds straight from SVN is going to be messy! If you want something more normal, check out a specific tagged release, i.e. processing-1.5.1, instead of using the trunk.

Versions

We will be doing a series of "alpha" releases as we prepare for 2.0. Alpha means unstable and that function names and APIs will continue to change (mostly in PShape, XML, and other new bits like JSON and Table). It might be a bit like driving a sports car but with the hood removed and one of the tires might occasionally blow out. We recommend using these releases if you're not going to whine about quirks and having to update code along the way (we just gave you a goddamned sports car, for chrissake).

Sorry, where was I? Right, beta releases. After the alpha releases will be "beta", which means the APIs will stop changing, but the bugs might still be around. You'll have a proper set of tires and a hood, but you might still need a coat of paint and a radio. With any luck, the software will be better than my car analogies.

The Big Stuff

  • P2D and P3D have been removed. Using P2D will simply use the default (JAVA2D) renderer, and P3D will try to use OpenGL. We made this change to simplify things for us, and focus our efforts on better feature parity across other implementations. This fits better with the situation on Android and with JavaScript, for instance. This will cause some sketches to actually run slower, but the bottom line is that we simply don't have anyone to help maintain all of this extra code. We hope to sort out the performance problems over time—if you see something weird, please report a bug.
  • OpenGL 2 – a new version of the OpenGL library has been implemented, and the old one has been removed. The new library is based on Andres Colubri's Android work (and his experiences developing the GLGraphics library). All the great things from Android have now been back-ported to the desktop version of Processing, so we have a super fast OpenGL library.
  • Modes – if you've used Processing 1.5, you'll know about the built-in Android mode, but if not, Processing now supports multiple languages and platforms. At the right-hand side of the editor window is a drop-down menu that allows you to choose between "Standard", "Android", and "JavaScript" mode. Those are the current modes that are being included, though we may add/remove modes as we head to 2.0 (a Jython mode is lurking about, for instance. Mmmm! Tempting.) Like Tools and Libraries, it will be possible for other parties to write their own modes that work inside the PDE.
  • JavaScript – the JavaScript mode (see above) allows you to write a sketch and quickly run it in a browser using Processing.js. The mode was developed by long-time Processing contributor Florian Jenett, and continues to evolve. We highly recommend using JavaScript for running Processing work in web browsers.
  • Video – we've removed the QuickTime for Java video library and are using a modified version of Andres Colubri's GSVideo library instead. On Linux, you'll need to install gstreamer to use the new library. On Windows and Mac OS X, you should not need to install it, however we're working out a few kinks in the whole process.
  • XMLElement is gone, but we've added the XML class instead. With the change, you can call loadXML("blah.xml") from inside PApplet to read XML data. The rest of the API is the same as it was for XMLElement, except that getXxxxAttribute() is now just getXxxx(), for instance getIntAttribute() is just getInt() (to be more like the rest of the Processing API). Also added XML.parse(String) which returns an XML object from a String of XML data.

Added and Improved

  • Added rounded rectangles via rect(x, y, w, h, radius) and rect(x, y, w, h, tl, tr, br, bl).
  • If you try to run more than one copy of Processing at a time, it will steadfastly refuse (and simply quit again). This isn't quite complete yet. Instead of just quitting the application it needs to bring the existing application to the front, and/or open the document you were trying to open with a new instance of Processing. But this will be sorted before 2.0 is released.

Change and Removed

  • screen.width and screen.height have been replaced by screenWidth and screenHeight. The originals were only half-documented and didn't properly fit with the rest of the Processing syntax.
  • delay() has been removed. Nobody understood what it did, and when they did, they didn't understand why it was there. Huge source of confusion, especially for beginning students. Ugh, delay() is back in 2.0a5. Not having it there is an annoyance for scripting and serial apps.
  • textMode(SCREEN) has been removed. SCREEN was a super fast/efficient way of rendering text with P2D and P3D, but since they're going bye-bye and it's actually slower in the remaining renderers, it's going away.

OpenGL Changes

  • The new version of the OpenGL library requires drivers that support OpenGL 2.0.
  • There was a bug in the lighting attenuation factor that was fixed in 2.0a5. This will mean that some lighting will look a little bit different.
  • We'll only be supporting Android 2.3 (Gingerbread) and later, starting with Processing 2.0a5. Due to a major API omission in the OpenGL bindings before 2.3, we can't support the earlier OS. There could be ways around this, or we could require 2.3 only when using OpenGL, but we don't have enough developers to support this sort of thing.
  • OpenGL sketches on Mac OS X will print an error message upon starting (or when changing the smooth level with smooth()/noSmooth()) that looks like: 2012-03-27 16:25:12.317 java[5741:1707] invalid drawable. This is an issue with Apple's Java plugin which seems to have no effect.
  • Calling smooth() and noSmooth() causes the OpenGL drawing surface to be recreated. Don't do that. Call one inside setup() and stick with it. Otherwise you'll get lots of flickering as it's rebuilt on each frame.

What's Coming

  • A better interface for installing and updating libraries, tools, and modes. Our Google Summer of Code project will be getting more refined over time.
  • Cleaner 32 and 64-bit support. The underlying code for 32 and 64-bit libraries is in there, but we need to do more to allow you to select which one is in use, how the Java VM handles it, and controlling what mode you're running in.

Changes in Processing 1.0 (revision 0162)

The biggest changes in the months prior to release 1.0 are as follows:

  • Libraries - All libraries must be placed in a folder named "libraries", inside the sketchbook folder. Do not use the main "libraries" directory in the Processing distribution, as it is reserved for the core libraries, and is not visible on Mac OS X.
  • XML - The XML library is now included by default, so you won't find it in the Import Library menu anymore. In addition, the XML library since 0135 has been greatly improved, making it compatible with far more documents.
  • Processing.app - The Mac OS X release of Processing is now a single .app file, more befitting an OS X application.
  • Processing.exe - The Windows release has a new launcher based on launch4j. Unfortunately, some machines have a problem with the new launcher that we haven't been able to track down. If you have trouble, please help us find the problem. PDE files are also now double-clickable on Windows.
  • OpenGL - All OpenGL sketches now use 2x full screen anti-aliasing. This means that these sketches are always smooth, and the smooth() and noSmooth() commands are ignored. To return to the behavior found in the beta releases, see the hint() reference.
  • P2D and P3D - The P2D renderer has returned (see the size() reference) and smoothing is now enabled for both P2D and P3D. Smoothing support is unfortunately incomplete, however, and sometimes thin lines can be seen inside shapes. This is a very high priority bug to be fixed in a future release.
  • Candy and PShape - The Candy SVG library has been merged into the core, which brings along a new loadShape() function and a new PShape object. The special powers of PShape will be rolled out in future releases. For the time being, loadShape() works best with the default renderer (JAVA2D). Complex shapes will often appear jagged or not at all when rendered with P2D, P3D, and OPENGL. We've also added better support for SVG files created with Inkscape.
  • PVector - We've added a new class called PVector, which is a simple three-dimensional vector (also known as point or tuple) class. This is useful for storing point data, or operations on 3D points.
  • Tools - A new Tools API has been created for developers who want to contribute code that extends the Processing Development Environment in some fashion. Let your creativity flow with fantastical contributions like "Color Selector 2.0", "ROT13 Code Mangler", and "I Am Rich". Visit the developer page on tools for more information. Similar to libraries, tools are installed in a folder of the same name within your sketchbook folder.
  • Asynchronous Images - Big JPEGs and small pipes? We've added a new requestImage() method that loads an image in the background so that your sketch doesn't freeze when loading lots of large images over a slow connection.
  • Sound - We've added Damien Di Fede's Minim library to the download. It uses the JavaSound API to provide an easy-to-use audio library. Minim has a simple API while still providing a reasonable amount of flexibility for more advanced users. Many thanks for Damien for his hard work on this excellent library.
  • Present - Present mode (full screen) is handled differently in 1.0. When run inside the PDE, only Mac OS X uses full “screen exclusive mode” with Present. Windows and Linux just do full screen windows. When run outside the PDE, all three simply create an undecorated window the size of the entire screen, and on the Mac, an option is added to the Info.plist file to hide the dock and menubar (since that cannot be done programatically from inside Java applications).
  • Compiler - We've removed the old Jikes compiler and are now using the ECJ compiler from the Eclipse project. We've also tried hard to improve the quality of error messages, though some are still real gems that sound like error messages from mainframe computers in 1970s films. If you don't like the messages please help us improve them.
  • Internationalization - For better internationalization support, we've changed to UTF-8 encoding when loading and saving sketches. Sketches that contain non-ASCII characters and were saved with Processing 0140 and earlier may look strange when opened. Garbled text and odd characters may appear where umlauts, cedillas, and Japanese formerly lived. If this happens, use the "Fix Encoding & Reload" option under the Tools menu. This will reload your sketch using the same method as previous versions of Processing, at which point you can re-save it which will write a proper UTF-8 version.
  • Java - Linux and Windows now inlude Java 6 update 10 with the download. We still don't have support for Java 1.5 syntax yet, but we hope that the performance boosts in Java 6 will help applications run well.

Under the old numbering system, Processing 1.0 is revision 0162.

Changes in Beta 0116+ (approaching 1.0)

Release 0116 contains many changes, frameRate(), beginShape(), and endShape() are the biggest ones.

  • framerate() is now called frameRate(), for better API consistency. It didn't make sense to have a frameCount variable and a framerate() method as its misshapen cousin.
  • The default frame rate is now 60 fps. This will prevent some odd quirks with sketches running faster than they need to and throttling the resources of your machine. To disable this, you can set the frame rate arbitrarily high.
  • beginShape() has changed. LINE_LOOP and LINE_STRIP have been removed because they are redundant, and not consistent with the rest of the API. beginShape(POLYGON) is no longer recommended, simply use beginShape() with no parameters when drawing an irregular shape. Code examples:
//OLD SYNTAX:
beginShape(POLYGON);
// call vertex() several times
endShape()
 
//NEW SYNTAX:
beginShape();
// call vertex() several times
endShape(CLOSE);


endShape() with the CLOSE parameter will make the stroke on your shape continue back to where the shape started. This is the same way that POLYGON and LINE_LOOP worked.

//OLD_SYNTAX:
beginShape(LINE_STRIP);
// draw with vertex()
endShape();
 
// NEW SYNTAX:
noFill();
beginShape();
// draw with vertex();
endShape();

In the above case, noFill() must be called, and the CLOSE parameter to endShape() is not used, because the last point should not come back to meet the original point.

// OLD SYNTAX:
beginShape(LINE_LOOP);
// draw with vertex()
endShape();
 
// NEW SYNTAX:
noFill();
beginShape();
// draw with vertex();
endShape(CLOSE);

For the LINE_LOOP example, endShape(CLOSE) is used to specify close the shape. noFill() must also be called, so that the shape is not filled in. The two main problems with the old API were 1) LINE_LOOP was simply a POLYGON with no fill setting, this made for a strange inconsistency. 2) there was no way to draw a non-closed POLYGON shape. Using beginShape(POLYGON) doesn't make much sense when you're drawing a line, so this is one more reason that beginShape() with no parameters is recommended.

  • The single pixel blend() methods have been removed, they were overkill. Also, the blend() function that blends a color, instead of image data, is now called blendColor().
  • Along with blendColor(), a lerpColor() method has been added. It works just like lerp()... but with colors!
  • writer() and reader() are now createWriter() and createReader().
  • toInt() and toFloat() are now parseInt() and parseFloat(), to change to JavaScript syntax. Not sure if anyone was using these.
  • Text with the JAVA2D setting no longer uses native fonts by default, which means they'll be slower and uglier. See the reference for textFont() for details and how it can be addressed.
  • Threading has been modified signficantly. Some of these changes had to be undone at the last minute, so further changes are coming. The changes will fix several strange InterruptedException problems.
  • The PGraphics classes have all been reworked and renamed.
    • PGraphics is an abstract class on which additional PGraphics subclasses can be built. It is an abstract class, and therefore cannot be invoked directly.
    • PGraphics2D (P2D) contains the former contents of PGraphics that are specific to 2D rendering. This will be P2D once it is complete. As of release 0126, P2D is not currently complete and cannot be used.
    • PGraphics3D (P3D), formerly PGraphics3, remains mostly unchanged.
    • PGraphicsJava2D (JAVA2D), formerly PGraphics2, is the renderer used when you call size(w, h) or size(w, h, JAVA2D). It remains the default renderer when none is specified. It is slower but more accurate than the others.
    • PGraphicsOpenGL (OPENGL) is the new name for PGraphicsGL.
  • Do not use "new PGraphics" to create PGraphics objects. Instead, use createGraphics(), which will properly handle connecting the new graphics object to its parent sketch, and will enable save() to work properly. See the reference for createGraphics.
  • For the same reasons as above, createImage(width, height, format) should be used instead of "new PImage" when creating images.
  • More recent releases include better support for ARGB format images. This is helpful for using createImage() or createGraphics() to generate a transparent surface. Be sure to use PNG or another format that supports alpha. This support is incomplete, however, and there are a handful of bugs.
  • beginFrame() and endFrame() are now beginDraw() and endDraw(). Use these around drawing commands to a PGraphics created by createGraphics(). The defaults() method should not/need not be called, just beginDraw() and endDraw().

Changes between Alpha (Release 0069) and Beta (Release 0085)

Between revision 0069 (the last public alpha) and the beta release (0085), many, many functions have been added, and are detailed in the reference. Aside from that, this page lists functions whose names have changed or fundamental API differences between the two versions.

  • loop() has been removed, and is instead called draw(). If you want applications to only run draw() once (the way draw() used to work), use the function noLoop() inside of setup().
  • size() should now be the very first thing in your setup(), otherwise commands that come before it may be ignored. your settings for fill() and stroke(), for instance, will disappear after you call size().
  • 2D and 3D graphics are no longer completely mixed. To specify 3D graphics, instead of size(200, 200), the new way is to use size(200, 200, P3D).
  • You may find that by default, your code runs more slowly in a beta release than an alpha release. The new renderers might be slower for some things, faster for others. If you want faster pixel operations, try using P3D (until P2D is available). For high-quality lines and strokeWeight() and strokeCap(), use JAVA2D (the default).
  • BImage → PImage, BFont → PFont, and so on...
  • For advanced users who were making their own BGraphics objects in the previous release:
BGraphics bg = new BGraphics(200, 200);

should be changed to:

 PGraphics pg = createGraphics(200, 200);
 pg.beginDraw();
 // drawing commands for pg here
 pg.endDraw();

We didn't realize quite how many people were using this, so we'll probably add a createGraphics() method because PGraphics2 may be temporary (instead of just PGraphics), and the "null" thing is pretty weird. Even still, this isn't quite working as expected, but it's a high priority to fix for the future, see Bug 92 for the status.

  • To use OpenGL rendering, change that to size(200, 200, OPENGL), and use Sketch → Import Library → opengl. OpenGL support is incomplete, but allows for much larger screen sizes and accelerated graphics that make use of a decent graphics card.
  • When using the pixels[] array of the main window, or on an image, you should first call loadPixels(). Once you're done editing, call updatePixels(). This is because the new JAVA2D and OPENGL renderers both need to post-process the image data before displaying it, which is a time-consuming operation.
  • Library events are handled differently because more than one serial port or video input device can be used with Processing beta. See the documentation for movieEvent(), captureEvent(), and serialEvent().
  • push() → pushMatrix()
  • pop() → popMatrix()
  • textureMode(NORMAL_SPACE) → textureMode(NORMALIZED)
  • textureMode(IMAGE_SPACE) → textureMode(IMAGE)
  • textMode(ALIGN_LEFT) → textAlign(LEFT)
  • textMode(ALIGN_RIGHT) → textAlign(RIGHT)
  • textMode(ALIGN_CENTER) → textAlign(CENTER)
  • textSpace(SCREEN_SPACE) → textMode(SCREEN)
  • textSpace(OBJECT_SPACE) → textMode(MODEL)
  • font.width(String s) → textWidth(String s)
  • font.ascent() → textAscent()
  • font.descent() → textDescent()
  • Fonts should now be more accurately sized, if your font sizing looks weird, try using "Create Font" to create a new font using the most recent release of Processing. It's strongly suggested that you do this when updated projects from alpha to beta.
  • The function alpha(), when used to create an alpha mask of an image, is now mask(), to remove a conflict with the alpha() function that extracts the alpha value of a color.
  • Previous default ellipseMode was CORNER → now it's ellipseMode(CENTER)
  • RGBA for images → ARGB (more technically accurate)
  • CENTER_DIAMETER → CENTER
  • objectX, objectY, objectZ → modelX, modelY, modelZ
  • curveSegments() → curveDetail()
  • bezierSegments() → bezierDetail()
  • splitStrings() → split() (changed in rev 0069)
  • splitInts() → toInt(split()) (changed in rev 0069)
  • splitFloats() → toFloat(split()) (changed in rev 0069)
  • angleMode() has been removed. Radians are used for all functions. If you don't like radians, you can convert to radians to degrees via the radians() function, i.e.: sin(radians(90)).
  • Four calls to bezierVertex(x, y) should instead be a single call to vertex(x, y), followed by bezierVertex(cx1, cy1, cx2, cy2, x2, y2) (two control points followed by the destination point).
  • The libraries for serial, video, and network have changed completely. Check out the examples or visit the libraries reference for the full details.
Personal tools