January 04, 2009

BlueSG: a basic 2D Java SceneGraph library

I've been spending some of my holiday time setting up a basic 2D scenegraph library for Java. It takes Java 2D graphics and adds a layer for easily setting up complex hierarchies of assets (bitmaps, text, etc.). Here is an example:

Sofar it supports arbitrary positioning and scaling of text, shapes, bitmaps and Swing components. The Swing components don't scale in the real sense; that is, only their bounds are scaled, not their contents (due to not knowing how to get that done correctly).

There exist some similar projects, but none seemed useful to me. There is, of course, Project Scene Graph (back-end of JavaFX), which I once tested at work for doing code visualisations. The conclusion then was that its performance was abominable for anything non-trivial due to the way it handled updates of the scene graph. More interesting is PulpCore, but this is targeted at applets. I tried hacking it into Java apps, but it was too much tied to browser contexts. Processing is another tool for setting up interesting visuals, but it doesn't provide something at the level of a scenegraph. It also uses its own programming language targeted towards graphics programming, which is nice but which could confront me with a language integration problem at a later time.

I, of course, have something in mind to use it for, but that idea is still in the design stage...