Crayon3D Project


Here is a project that we did at Entertainment Technology Center (ETC) at CMU.

Crayon3D is a project at ETC that aims to create a new platform for the BVW class. Part of the goal is to provide an interface to use Wiimotes as an input device in Panda3D. In addition to this, Crayon3D also provides a simple interface to ODE for simple physics simulations and collision handling.
Our focus for this project is to use the Wiimote’s IR camera for tracking infrared points for finger tracking and fish tank VR (similar to Johnny Lee’s head tracking).

Please visit our website for more information.


  • Full integration with the Wiiuse Library
    -Support for:
    - Accessing wiimote data (buttons, accelerometer, IR camera)
    - Accessing wiimote expansion devices (nunchuk, classic controller, guitar hero 3 controller)
  • Includes helper classes for:
    • Controlling and managing wiimote resources
    • IR Point tracking as a cursor (for finger tracking)
    • IR Point tracking for Fish Tank VR
    • Gesture Recognition
  • Simple interface to the ODE library
  • Well-documented source code
  • API Reference
  • Expandable

Version 1.0.0 is now available and can be downloaded from The package includes a How-To Presentation, an API Reference, a sample code, Crayon3D source and DLLs.

– Sharkee

Sounds great! But is there also source code available? I’m on Linux. :frowning:

just the Wiimote interface is a feature that make me scream but sadly it seems so a closed project and for windows only.
The idea is awesome nonetheless.

same question here, where’s the linux/mac version :stuck_out_tongue:?

wiiuse library is opensource(gpl3), it runs on windows and linux (macport seems not to be maintained since noone there owns a mac)

the crayon thing seems to use ctypes so… i dont really see a real reason why one could call it “closed” , aside from… i don’t see a license anywhere at all??

well from what i can see it would be possible to make it run on linux and mac with some effort.

on a second thought (and watching closer the package files) I were half wrong and you got half right Tomas, half package is indeed open (pure python) but the real deal is indeed the Wiimote thing and we linux-ers are unable to try it out just because are compiled .dlls, therefore ‘closed’.

The source code to build the DLLs are posted in the Crayon3D website.

Sorry about that.

We didn’t test it in Linux but it should work.

Please PM me if there are any problems.


– Sharkee

By the way, we use Panda 1.6.0.

thank you sharkee, I appreciate it

Ah, I didn’t notice the second download on the download page, after scrolling down.

So, I downloaded and compiled wiiuse, and installed it into my system.
Then I downloaded the wiiuse_al library from the Crayon download site.
The code wouldn’t compile for a few reasons:

  1. Linux knows no __declspec, I just put "#define EXPORT " there.
  2. Got this error with compiling:
wiiuse_al.c: In function ‘get_ir_sensitivity’:
wiiuse_al.c:644: error: ‘wm’ undeclared (first use in this function)
wiiuse_al.c:644: error: (Each undeclared identifier is reported only once
wiiuse_al.c:644: error: for each function it appears in.)

I didn’t bother to further investigate so I just commented out the function definition and declaration.

Then I compiled the stuff into a library:

gcc -shared -fPIC -o wiiuse_al.c -lwiiuse

Then I tried it with crayon, after changing the “LoadLibrary” call to load “”, but I had this error:

AttributeError: /usr/local/lib/ undefined symbol: init

Probably I shouldn’t have removed the __declspec?

Hmm… this is weird. I was just calling a macro here and wm is one of the macro’s parameters.

Not sure about this one but I think Linux doesn’t have __declspec. I’ll try to investigate these further after I revive my old Linux box.

As I said, we haven’t really tried to run this in Linux since all of the workstations used for BVW are windows. Any help on this will be greatly appreciated.

– Sharkee

Oh. I found this in the wiiuse source code:

#define WIIUSE_GET_IR_SENSITIVITY(dev, lvl) \
	do { \
		if ((wm->state & 0x0200) == 0x0200) 		*lvl = 1;	\
		else if ((wm->state & 0x0400) == 0x0400) 	*lvl = 2;	\
		else if ((wm->state & 0x0800) == 0x0800) 	*lvl = 3;	\
		else if ((wm->state & 0x1000) == 0x1000) 	*lvl = 4;	\
		else if ((wm->state & 0x2000) == 0x2000) 	*lvl = 5;	\
		else									*lvl = 0;	\
	} while (0)

This seems to be a typo in the wiiuse library, the parameter is called “dev” while the variable used is “wm”. I’ve contacted the wiiuse developer about this bug.
It might be a good idea to redefine this correctly in the wiiuse_al library.

I’ve been told that on Linux, everything is exported by default, and __declspec(dllexport) is not needed.

The __declspec syntax is a Windows-only syntax for marking symbols for export from a dynamic library. Since this is the default behavior on Linux and on every other system in the world, simply omitting the syntax is the correct thing to do for Linux. (You would use the attribute syntax only if you enabled certain obscure compiler settings that made this necessary.)

Incidentally, this is the purpose of the EXPCL_PANDA etc. symbols in front of almost every class name in the Panda source code. This macro is defined to map to __declspec on Windows, and nothing at all everywhere else.


I’ve found what I was doing wrong - I accidentally compiled with g++ instead of gcc, resulting in different symbol names.
I recommend putting this around the function declarations in wiiuse_al.h:

#ifdef __cplusplus
extern "C" {

.... function declarations ...

#ifdef __cplusplus

Now it works and the sample runs :slight_smile:

I use the Crayon3d project and it is really cool.

It seems that the download site of crayon3d is down, so I put the project on rapidshare. I hope it is ok;) …

Under windows everything is fine except you have to buy the bluesoleil blutooth software.

So it would be nice to run it under linux;)
Rdb posted that he downloaded the wiiuse_al from the crayon download site, but well it is down;(

I downloaded and compiled wiiuse too. Then I changed the code of wiiuse_al to use my instead of the wiiuse.dll. Here is my code

# Open the DLL
#dll = ctypes.cdll.LoadLibrary("wiiuse_al.dll");
dll = ctypes.cdll.LoadLibrary('')

## Function: init()
init = dll.wiiuse_init();
## Function: disconnected()
disconnected = dll.wiiuse_disconnect();

and so on.
After starting the demo, I got a segmentation fault. Next step was the gdb where i find out:

Program received signal SIGSEGV, Segmentation fault.
0x0696a1cc in wiiuse_find () from /usr/lib/

Now I need some help;)