Adventures in TUIO libraries
A few months ago, David Nuñez, Mac Cowell, and I hacked out a shaky demo at DevHouseBoston5, replicating a basic reacTable implementation. Though the code lay dormant for a few months, I’ve recently picked up the project again, and have been hacking around for a few evenings.
I have an initial and extremely simple goal of creating a multitouch paint application with TUIO; the “Hello World” of multitouch applications (hey, at least it’s not a blog!)
First, I tried rubygosu with aberant-tuio-ruby. rubygosu doesn’t seem to play well with threads, since it’s event loop driven, and did not yield up to the TuioClient often enough, so there was sometimes lag in the TUIO events propagating into my application. Even if I adjusted the thread priority levels, it didn’t help.
Then, I tried using eventmachine to just read in OSC via UDP, but this suffered the same outcome. More threading, forking with IPC, and a brief foray into unix signals all left me unsatisfied.
So, I went back to using aberant-tuio-ruby, and added a Thread.pass into the game loop and the OSC handler events. Lo and behold, this seemed to smooth things out. It was still kind of jumpy, with noticeable lag creeping in during bursts of activity, but I had achieved my first software goal of moving a 2D cursor in an OpenGL-accelerated window based on incoming TUIO events that I sent from reacTIVision’s TuioSimulator. (It’s called painter, even though it doesn’t really paint things.)
I downloaded the reacTIVision Java TUIO library via tuio.org to see if maybe Java would be a bit snappier. Holy baloney! Super snappy! I sighed heavily, as I though that I will likely have to depart from Ruby. As I’m curious about the viability of developing in ActionScript 3, I wonder if this is an issue that plagues Flash-based TUIO apps, as well.
Anyhow, before I get ahead of myself, I’ll replicate painter in Java, moving a 2D cursor around, and then move on to painting things. I am disappointed that I’ll likely not be using Ruby, but maybe JRuby holds a nice surprise. Actually, that’s a very compelling idea…
Next step: implement a simple paint app in Java, using the TUIO Java library’s example as a reference, and then give jruby-painter a shot.
0