When it rains …
Processing on October 1 got not one but three updates in one day, 0116, 0117, and 0118. Yes, whether it be commercial or open source code, it’s generally best to let the code settle down a little bit before unleashing it on your machine. That said, Processing 011– um, let’s just refer to it to “the current version of Processing” to be safe — has a lot of promising-looking features. They can be summed up in three basic items: bug fixes, an overhaul to PImage, and full JOGL 1.0 support. I’ve been using a lot of the functions that were adjusted, so here’s my take on what’s new and how to adapt.
If you’ve tried to work with pixel data in PImage objects in Processing 0115, the release that was available from May through the end of September, you may have been quickly frustrated. Most existing PImage functions work (that is, anything you do with Processing involving pixels), but what you couldn’t do was easily create your own PImage objects and copy to that, which is necessary for creating off-screen pixel buffers and other functions, and absolutely critical for tasks like video analysis and motion tracking. (Note that the JMyron video library tends not to play nice with PImage, aside from either iterating through pixels one at a time from the JMyron objects, or using a fairly limited copying function that copies only from the main camera object to the main pixels array. That’s another story, though.)
PImage has now been fleshed out and sorted, and get ready to do some find and replace on existing code, because everything now uses a new function called createGraphics(). The whole thing is more readable and usable and more finished-looking. See the details in the createImage reference. PGraphics is also sorted, with the corresponding createGraphics. Best of all, images now finally support ARGB transparency, so dealing with masks and transparency is much more … possible. (Transparency was totally broken in 0115, which in related news means I’m not crazy.)
Most importantly, this also means that a lot of documentation that was missing or out-of-date has now been updated for PGraphics and PImage. If you just joined the Processing party, as I had this summer, you might have found yourself surprised when the forums kept referring to instructions that weren’t available.
In terms of changing your code, the other syntax to pay attention to is in the drawing department. Here’s an example from the release notes:
// call vertex() several times
// call vertex() several times
Basically, the shape types have been adjusted (with line_loop and line_strip combined) and syntax has been slightly modified. Read the full notes so your drawing code works.
On the 3D front, JOGL support is up to 1.0 instead of the beta release that was previously supported.
And, needless to say, there are a zillion bug fixes and minor adjustments in there. Here’s your best bet: download 0118 (or whatever happens to be available when you read this), and install alongside 0115. Copy your code folder, so any code you modify can be safely reverted to the old version. Adjust the syntax of a 0118 code folder to the new release, leaving your old folder. Then run the two versions of Processing side-by-side, which is easy to do since they each have their own folder.
Then, read through the copious release notes on Processing’s forum. (Anyone with other resources to suggest, please chime in.)
As it happens, I’d just finished work on a Processing project that used the old drawing syntax, the deprecated line_strip drawing type, PImage, and new PImage — somehow, I zeroed in on everything that was about to be changed. The code adjustments look fairly simple, though, so I’ll get on it. If you’ll excuse me.