Personal Blog Post:

3D on the Web - Back to Processing...

Finally got some time to play with Processing again. It's been a hugely busy year with work and I have literally had no time to do any of my own stuff - you can see it's more than a year since my last post on this site. But, like many people in the UK, I took vacation time either side of Easter to take advantage of the Royal Wedding and May Day bank holidays. This gave me a bit of breathing space to look at WebGL and basic app development on iPad and Android, something I'd been looking forward to for a while. However, I always keep coming back to Processing.

First the Brickbats...

I'd love to be able to say that this is because it just works, but quite often for me lately it doesn't. When I started playing a bit again over Christmas I hit the 'unexpected token void' bug and none of my previous code would work with 0192. After getting around that, something in the graphics had changed and the 3D code I built up last year was producing garbage. Processing isn't the ideal debugging environment and I lost many hours tracking that one down. To top it off, I spent most of my holiday recoding my user interface and 3D modelling classes in v1.5, only to find out that there is absolutely no way I can get a v1.5 produced applet to run while embedded in a web page or started with JNLP. Exactly the same code/sketch works fine in v1.09 in both instances, so that's the version I've had to use to create the web applets I'll be uploading over the next few days.

UPDATE: This seems to be a known bug in Processing (Issue 666). For me, it seems to be Windows-specific or something to do with my Java 1.6.0_XX configuration. Exporting exactly the same sketches from v1.5 in MacOSX works fine, embedded in a page and via JNLP. I replaced my Windows generated v1.09 JAR files with the Mac v1.5 ones and they seem to run fine even on my Windows machines. Of course, for some reason now Safari on the Mac has decided that the first mouse click should send the model view into some weird upside down orientation, but you can quickly reorient it so I can live with that for now.

Then the Bouquets...

That said, Processing is a fantastic environment to play in. The work on OpenGL2 (unfortunately removed from v1.5) looks really great and the experimental Shape3D class was an inspiration. Even the P3D graphics improvements are really impressive, especially when the camera is inside a model and there is geometry behind it.

What I do really like about Processing is how well it allows you to combine it's own graphics functions with raw calls to OpenGL and JOGL - this really helps with the experimentation process (and - before you ask - no, I'm not doing any of that in the web applets that won't work in v1.5). All of which brings me to the main theme of my holiday experiments...

3D on the Web

WebGL looks great, but it's implementation still varies a bit between Chrome and FireFox - with the version of Chome I tested having all sorts of problems rendering form items on the same page (see Chromium Issue 71624). However there is no doubt that it's the future so I've been experimenting fairly widely, and also with x3dom which is a great technology. But neither run in IE or on the iPad, and Fennec on my Android tablet seems very picky about the code that it will actually display. Thus that particular basket is worth a few eggs, but not too many just yet.

To mention some non-WebGL options, there are quite a few Canvas-based 3D frameworks such as three.js and pre3d which do a great job and the Unity games engine is a great commercial write-once run-anywhere option.

However, I really wanted to experiment with fast OpenGL and GPU shaders, yet still have the opportunity of creating a web app that anyone could use if I wanted. Thus, my main aim over the holidays was to develop a common infrastructure that I could use on the web, in mobile apps and as applications for all three major operating systems.

It's hard to look past Processing for this as it's pretty well all there already. Android mode in v1.5 works surprisingly well (even if it sometimes likes you to beg a bit first) and Processing applications already work locally across all major platforms and as web applets. The latest version of Processing.js now supports WebGL as well as Canvas, and the Processing For The Web project bodes well for an interesting future.

The only missing link is the iPad, but I figured that if I stuck mainly to raw OpenGL, for both user interface and modelling, there probably wouldn't be too much work required to wrap that in an XCode-generated window. Moreover, I recently purchased MonoTouch which means even less work - basically converting Java to C# and using the standard OpenGL ES canvas.

Conclusion

For me, at least for the moment, Processing is great as the core of my personal experiments with 3D on the web. By keeping my classes simple and OpenGL-specific, I can quickly use most of the same basic code to create web, mobile and local applications. Now I just have to work on the problem of having absolutely no time to write them.

Your rating: None Average: 3.8 (4 votes)