Monday, February 29, 2016

Syphoning Processing

As some of you may know, I recently discovered Processing.  My focus is open up the the Kinect to the Mac side of the house.  OpenNI is kinda hard to access and the official Kinect SDK is Windows only.  There is a build of OpenNI being maintained at structure, though at the time of this post, all of the versions are in beta.

Through developing that workflow, I discovered that you can build Syphon servers rather easily in Processing.  As some of you have discovered syphon servers are another way to bring in content for MadMapper.  The Syphon library is easy to install, and requires only a few lines of code to implement.  An example showing the lines you'll need to add on Github.

I discovered last week that complex Processing sketches with multiple tabs of code, can cause an otherwise working sketch to fail when the Syphon code is added.  After performing a number of face-palms, and shouting a variety of expletives, I discovered that if all the code is in ONE tab, then the syphon server will work as expected.

From what I can tell, when using the sendScreen command, you're essentially sending a copy of the Processing output window to a Syphon server at the same time.  Might be some performance gains if that wasn't the case, but then again, was running this test on a 2014 MacBook Air... not exactly the normal use case for that particular machine.

There is another method that uses a "Canvas" to feed the syphon server, and appears to work with most primitive graphical elements.  The sprites I made were not easy (for my Processing noobie self) to send to a separate PGraphics object.  On the other hand, using this method you can have your sketch only go to the syphon server, which may result in a higher FPS.

All that said, I'd suggest that you build sketches any way you need to, as far as organizing code.  When you're ready to add in the Syphon part, put together a separate version with all the code on one tab.

Looking forward to seeing the work this evening.

No comments:

Post a Comment