V

Avatar



1d to 2d

At some point you might end up needing to convert a 1d index value to access a 2d array. Here’s how you can do it.


int x = index % xres;
int y = index / xres;

As noted by Diogo Teixeira, one way to get rid of the mod/div operations for POT buffers would be:


int precalc_a = ( xresPOT - 1 );
int precalc_b = (int)log2( xresPOT );
int x = index & precalc_a;
int y = index >> precalc_b;

.





OpenNI Block of Code

OpenNI, a library created by PrimeSense. It’s quite famous for its ability to use the Kinect to track users and feed us with a usable skeleton per user. Since i wanted to give this a try and play around with the skeleton tracking i had to have this. So i did. In the end i ended up with a wrapper around this API. It’s open-source and available to everyone. Its not perfect and needs work and more features, but it’s just a start. Use it at your own risk and with your favourite creative framework. It’s possible.

You can find it at github.





CgFX Block of Code

I have been doing more and more work away from java/processing so i had to bring some tools with me to help and improve development time. One of my favourite shader languages is CgFX, a brother of HLSL. I spend alot of time using this for my shader programming, so i wrapped it up in a simple to use block of code that should be easy to use with your favourite framework.

You can find it at github.





CLNUI 4 Java (Kinect)

Kinect is a new product from Microsoft for XBox360. With an RGB camera, a 3D depth sensor (structured IR light) and  a multi-array microphone , it is able to compute a depth map, something very interesting for the interactive world of creativity and gaming. Nothing new as technology, but still, interesting and cheap. Since its release people have been trying to work in order to hack it and get it to work with windows and mac OS. Quite a few people have been working on drivers and a way to hack the gadget to get access to the color/depth data. One of these people is called Alex from Code Laboratories, the man behind the PS3eye camera drivers for PC’s. Recently, he released a new package (C and C#) that includes drivers and SDK for Kinect. I took the SDK and with  JNA i wrote a library for java that wraps the original one and also tries to make its use easy for starters.

A very early release is available http://victamin.googlecode.com/files/CLNUI4J_01.zip. This might or might not work out-of-the-box and it sure needs improvement and more work, but as they say, release early, release often. This package includes the library and basic examples running on Eclipse IDE and processing IDE (untested). It is known that this library does not work directly with Processing.

EDIT! Version 0.2 is now available at: http://victamin.googlecode.com/files/CLNUI4J_02.zip.
You can now find a friendly wrapper and a couple of examples to get you started.

I would love to get some feedback, so if you’re a Kinect owner and you’re into java/processing, give it a  spin and let me know how it works out for you.

Have fun.





GML Viscosity

So here it is, the application and source code for GML Viscosity.

I finally took the time to clean up this project and make a public release. In the packages you will find binaries and source code for the application, so if you’re thinking of using it and come up with something nice, let me know. After the first release i have fixed some problems with memory access and crashes. I have also added a simple UI for easy pick of tags from the “data/tags” folder on your hard-drive.

What is it?
- GML Viscosity
is an experiment. It is application used to draw GML tags on a viscous liquid rendered purely on the GPU side.

What does it do?
- It liquifies your tags, in a way you can hardly read them but still looks cool (thats graffiti).
- It is possible to load gml files from the disk or directly from the “lots of zeros”book database.

How can I interact?
- Not implemented on this version. This version selects and draw gml files randomly from the web or from a tags folder. For a smart person it should be easy to add mouse support. The code is also prepared to support multitouch so, it should be easy to implement TUIO and create your multitouch version.
- Use ‘r’ key to randomly fetch a new tag from the website and if available it will draw it on the screen.
- Use the GUI window to pick any tag from the folder “tags” inside data folder.

Where can i get it?
Windows Version | MacOSX Version

Have fun.