Sponsors of Wiimoteproject.com
IR Pens for Wiimote Whiteboard
Wiimote Project » Wiimote Projects » Wiimote Desktop VR/Head Tracking » VR Headtracking in Linux with OpenGL - working!
Pages: [1]
  Print  
Author Topic: VR Headtracking in Linux with OpenGL - working!  (Read 8974 times)
0 Members and 1 Guest are viewing this topic.
*
Karma: +1/-0
Posts: 8
Offline Offline
View Profile
« on: May 01, 2008, 11:20:44 AM »

I spent some time testing out the various "head tracking" demos written with OpenGL and none were complete. Many lacked wiimote support, and others simply didn't get the perspective transformation right. A few weekends ago I picked up a wiimote and wrote this program over the course of a few days. Many thanks to Johnny Lee for making the original version for Windows! His project was obviously my inspiration for this Cheesy.

Note that although the code works fine on my machine, you'll need to compile it once you set up your screen and IR bar settings. I suggest familiarizing yourself with the code before you compile and run it. Make sure you have the cwiid library and MesaGL/GLUT.
I admit that it's quite unpolished at the moment, but I see a LOT of questions about how to do this in OpenGL so I wanted to release the code so others don't have to bang their head on walls anymore trying to understand this. I will be improving the documentation over the next few weeks, as well as writing a tutorial on how the perspective transform works, including pretty diagrams for all of those who can't learn without Grin.

I posted my code here:
http://stsnyder.bol.ucla.edu/
Click on "Wiimote Projects"

It's written in C and uses the cwiid library for wiimote access.

It does not currently support textures or any other goodies like that. The targets are draw as two quads each. I drew a grid with lines for reference. I will clean up the appearance in the next few versions.

In the next version I will have a better interface for setting it up for your screen and IR light bar. I have have a bunch of other projects going on right now, so I'm sorry I can't work on this at the rapid pace I did when I just wanted to get it working.
Yes, the perspective correction works PROPERLY. I've seen a lot of demos that just move the camera around, without doing the proper transformation.

Thanks,
Steven Snyder
Logged
*
Karma: +1/-0
Posts: 8
Offline Offline
View Profile
« Reply #1 on: May 22, 2008, 10:47:27 AM »

 Shocked 180+ views and no replies?
Has anyone tried out my program?
Logged
*
Karma: +0/-0
Posts: 1
Offline Offline
View Profile
« Reply #2 on: May 24, 2008, 10:05:57 PM »

Just tried it, and it works for me, thanks. Will play with it more after I alter some glasses with IR LEDs...

/Rick
Logged
*
Karma: +0/-0
Posts: 1
Offline Offline
View Profile Email
« Reply #3 on: May 25, 2008, 02:37:35 PM »

It took me a little while to get it working (I didn't realise I had to install the dev packages for cwiid and glut).

Thank you so much! The Windows version blue screened my laptop, but this version works just fine on my Ubuntu-powered media center :-D
Logged
*
Karma: +0/-0
Posts: 1
Offline Offline
View Profile
« Reply #4 on: May 27, 2008, 01:53:52 AM »

Hey Steven,

I've been cursing the need to get windows installed to try this demo for over a month now - finally found a spare machine, put windows on it, and was just thinking about trying to get the bluetooth stack working when I saw your post.

I installed the deps the guy above mentioned, typed "make" and ran it.  Held buttons 1&2 down, ran it again, and wow - it just worked!  I didn't have the IR bar to hand and had a quick go with my TV remote (which didn't do the trick) but then I noticed that my living room lights seem to emit some IR which let me demo that it works.

Good work - this is great - I'm going to have a play with the code later once I've sorted out a pair of special IR specs ;-)  If I do make any modifications I'll post them back to you.  (C isn't my strong point so it's quite possible I might not manage to do anything worthwhile!)

Dave
Logged
*
Karma: +1/-0
Posts: 8
Offline Offline
View Profile
« Reply #5 on: May 31, 2008, 03:34:17 AM »

Hi guys, thanks for the replies. I'm glad its working for you.  Cheesy

My apologies for the lack of updates; I've been working on a computational genetics project and all of my programming time has been going to that for the last month.

Enjoy!
Logged
*
Karma: +1/-0
Posts: 8
Offline Offline
View Profile
« Reply #6 on: June 08, 2008, 11:30:43 AM »

I had a newer version sitting on my computer that I forgot to upload. It's up now. I got rid of those horizontal grid lines on the front of the screen; those were just for testing purposes.. I didn't mean to leave them in the last release. Sorry about that! Looks clear now.

-Steven
Logged
*
Karma: +1/-0
Posts: 8
Offline Offline
View Profile
« Reply #7 on: June 10, 2008, 09:37:14 AM »

I reorganized and rewrote the code. The project will now be developed in C++.

Here is the latest (C++) version. It has identical functionality to the previous version, but the settings are now in a seperate header file, and the code is overall much easier to work with.

http://stsnyder.bol.ucla.edu/projects/wiimote/trackingdemo0.30.tar.gz
Logged
*
Karma: +0/-0
Posts: 3
Offline Offline
View Profile Email
« Reply #8 on: May 07, 2010, 02:17:07 PM »

Hi,

I download your program. However I encountered an error while compiling.

+ cc wiiheadtracking.cpp
cc1plus: warnings being treated as errors
wiiheadtracking.cpp: In constructor ‘TrackWiimote::TrackWiimote()’:
wiiheadtracking.cpp:66: error: taking address of temporary
make: *** [wiiheadtracking.o] Error 1

May I know what cause this error?

Thanks!
Jimmy
Logged
*
Karma: +1/-0
Posts: 8
Offline Offline
View Profile
« Reply #9 on: July 06, 2010, 07:34:16 AM »

Hi,

I download your program. However I encountered an error while compiling.

+ cc wiiheadtracking.cpp
cc1plus: warnings being treated as errors
wiiheadtracking.cpp: In constructor ‘TrackWiimote::TrackWiimote()’:
wiiheadtracking.cpp:66: error: taking address of temporary
make: *** [wiiheadtracking.o] Error 1

May I know what cause this error?

Thanks!
Jimmy

Either the cwiid library had some changes, or my version of GCC didn't report the "taking address of temporary" warning. In either case, it can probably be safely ignored as a warning. Open the Makefile and remove '-Werror' from the CFLAGS line so it looks like this, then try to compile again:
Code:
CFLAGS = -g -W -Wall -Wno-unused -O2
Logged
*
Karma: +0/-0
Posts: 2
Offline Offline
View Profile Email
« Reply #10 on: August 14, 2010, 02:50:06 AM »

Sorry if it is a very foolish mistake, but i have an error compiling it.

It's quite long so i pasted it on paste bin, here is the link:
http://pastebin.com/6SKzypAz

Thanks!  =)

PD: I have glut, cwiid and opengl installed.
« Last Edit: August 14, 2010, 02:53:43 AM by pedrozs » Logged
*
Karma: +0/-0
Posts: 2
Offline Offline
View Profile Email
« Reply #11 on: August 14, 2010, 03:46:19 AM »

Sorry for disturbing, i've found the answer; i had to install development versions of the packages.
Logged
Pages: [1]
  Print  
 
Jump to:  

Clicky Web Analytics