Pages: [1] 2 3 ... 8
Author Topic: ofxTuio  (Read 16062 times)
moka
Kiel - Germany

Posts: 409

Gravatar


WWW
ofxTuio
« on: October 15, 2008, 07:09:14 PM »

Hello,

I finished a first version of a TUIO Client class for OF. It uses ofxOSC so it's really easy to use. Right now I only tested it in xCode on Mac but it should work cross plattform (because of ofxOSC). You can download it at:
http://addons.openframeworks.cc/projects/show/ofxtuio

It also includes an example. I recommend to test it with tuio simulator. get it here:
http://reactable.iua.upf.edu/?software

See a video here:


If you find any bugs please tell me. Furthermore you can also improve things in general if you want to since I am pretty new to c++ and programing in general.

For future releases I plan to add 3D tuio support.

Cheers

moka
« Last Edit: October 17, 2008, 10:16:33 AM by moka » Logged
memo
London, UK

Posts: 747

Gravatar

I like to touch people and make them giggle or cry


WWW
(No subject)
« Reply #1 on: October 15, 2008, 08:58:29 PM »

awesome! will try this out asap...
« Last Edit: January 01, 1970, 01:00:00 AM by memo » Logged
Seth
Global Moderator
California

Posts: 580

Gravatar


WWW
(No subject)
« Reply #2 on: October 16, 2008, 05:54:58 AM »

Wow awesome!

I'm glad you got it working! Did you end up using any of the c++ reactivision client?

I'll be sure to check this out VERY soon. Will you be including an event system so we know when fingers/objects are down/up/moved?
« Last Edit: January 01, 1970, 01:00:00 AM by cerupcat » Logged

moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #3 on: October 16, 2008, 06:13:37 AM »

Thanks!
I actually used the processing and c++ classes from reactivision as reference. I also plan to add events. If anybody else wants to add things just gor for it because I need to wrap my head around it first.

What would be the best way to implement events? Maybe Using poco?

BTW: I made small changes to the curent version. download it here:
http://addons.openframeworks.cc/projects/show/ofxtuio
« Last Edit: January 01, 1970, 01:00:00 AM by moka » Logged
arturo
Administrator
barcelona

Posts: 2395

Gravatar


WWW
(No subject)
« Reply #4 on: October 16, 2008, 10:43:23 AM »

Hi moka

The way to go to implement events, is poco, with a particular pattern to hide the implementation details from the users, you can take a look at ofxMailUtils, to see how it's organized. The trickiest part is the forward declaration of the listener and manager in the .h file for the class that generates the events (in my case ofxMailUtils.h)

Also if you can wait, I have a python tool to generate the code for the events, it's not yet working for the very last implementation, but it should be easy to modify. I'll post when it's complete.
« Last Edit: January 01, 1970, 01:00:00 AM by arturo » Logged
moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #5 on: October 16, 2008, 11:02:43 AM »

that sounds great arturo! I have time, right now I don't need any events. I only need cursor positions right now since it will only be used for some tracking. I will take a look at your src code anyways. And please let me know when your tool is done!
« Last Edit: October 16, 2008, 11:57:37 AM by moka » Logged
moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #6 on: October 16, 2008, 11:43:03 AM »

Is #include "Poco/BasicEvent.h" what I need?
http://www.appinf.com/poco/wiki/tiki-in ... page=Event
« Last Edit: January 01, 1970, 01:00:00 AM by moka » Logged
arturo
Administrator
barcelona

Posts: 2395

Gravatar


WWW
(No subject)
« Reply #7 on: October 16, 2008, 11:50:04 AM »

yes, that and delegates, but if you just use them directly, the syntax to register an application to the events will be fairly complicated.
« Last Edit: January 01, 1970, 01:00:00 AM by arturo » Logged
moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #8 on: October 16, 2008, 02:25:04 PM »

okay thanks, I will see if I can figgure out a way how to implement the events as easy as possible. if I understand you correctly you would write a class that contains all the poco stuff (like the ofxPop3EventListener in your ofxMailUtils).
« Last Edit: January 01, 1970, 01:00:00 AM by moka » Logged
arturo
Administrator
barcelona

Posts: 2395

Gravatar


WWW
(No subject)
« Reply #9 on: October 16, 2008, 03:00:19 PM »

Yes, you should have an events folder in your addon, and there a .h file that contains a listener, a manager and perhaps another class for the parameters of the event.

The listener is the class you inherit to be able to receive the events from your app.

The manager implements the addListener, removeListener and notify methods that manage all the poco related stuff. You can have different methods for this: don't remember the tuio events but can be something like:
addNewObjectListener, addObjectRotatedListener...

Then for your addon I suppose you will only need to register listeners to one instance (there are no separate controls to which you need to register listeners independently) so you can create a global instance of the manager, that should be called something like ofxTuioEvents so you can register listeners by calling

Code:
ofxTuioEvents.addListener(this);


Take a look at ofMouseEvents.h, I think is the most similar to what you need

If you have any problems just post when you have something done, and i'll try to help.
« Last Edit: January 01, 1970, 01:00:00 AM by arturo » Logged
moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #10 on: October 16, 2008, 03:56:53 PM »

Thank you very much arturo!

Just some more general things:

I plan to implement

moved, down and up events.

Isn't a cursor always down if it is alive? and up if it gets removed/dies? Does anybody know how other Tuio clients do it?
« Last Edit: January 01, 1970, 01:00:00 AM by moka » Logged
Seth
Global Moderator
California

Posts: 580

Gravatar


WWW
(No subject)
« Reply #11 on: October 16, 2008, 06:36:49 PM »

moka:

Well yes it's always down if it's alive, but you usually need to know when it was first down. So a down event would be when it's first down, just lick when a mouse is first pressed. Then move (or update) would be where it is after the initial down and up would be an event sent when it's no longer alive.

You can see where we send events in the AS3 flash TUIO classes I posted in your other thread. We also dispatch events for rollover, rollout. I'm not sure how all that translates to C++.
« Last Edit: January 01, 1970, 01:00:00 AM by cerupcat » Logged

moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #12 on: October 17, 2008, 09:45:46 AM »

okay, here is what I did so far:

I rewrote ofMouseEvents just for testing and added it to simple app like that:

Code:
class testApp : public ofSimpleApp, public ofxTuioEventListener{...}

Then in setup I added it to the events manager like that:

Code:
ofxTuioEvents.addListener(this);


that works so far. is that the way you wanted to implement it? I am actually really confused about how to progress from there and if this is the way I should be doing it.

PS: I also added a video so you don't need to download it if you just want to see what this is about:
« Last Edit: January 01, 1970, 01:00:00 AM by moka » Logged
arturo
Administrator
barcelona

Posts: 2395

Gravatar


WWW
(No subject)
« Reply #13 on: October 17, 2008, 12:25:09 PM »

Yes that should be. Now if you want to register to different events individually, you have to create the methods for them, like:

addDownListener
addUpListener
...


Then when that events happen in your tuio class you need to call ofxTuioEvents.notify(this)

If you want to upload what you have by now, i'll take a look.
« Last Edit: January 01, 1970, 01:00:00 AM by arturo » Logged
moka
Kiel - Germany

Posts: 409

Gravatar


WWW
(No subject)
« Reply #14 on: October 17, 2008, 01:53:29 PM »

THanks again arturo. I added some notifications in the ofxTuioClient.h and I at least get the notifications. Anyways they don't seem to be "blob specific" right now.

I uploaded the source for you on my googleCode account. Check it out here:
http://code.google.com/p/mokacode/downloads/list

I commented the parts where I send any notifications so you can find it easier.

Thanks in advance for your help!
« Last Edit: January 01, 1970, 01:00:00 AM by moka » Logged
Pages: [1] 2 3 ... 8
 
Jump to:  

Powered by SMF 1.1.15 | SMF © 2011, Simple Machines
kinect

viagra priser