Hello Thomas,

On Mon, May 20, 2013 at 4:25 PM, Thomas Lerman <osgfo...@tevs.eu> wrote:
> Thank you Jan. I will have to check it out. I will take a look at the 
> tutorial you mentioned previously to see how to do that (I presume that is 
> where you would suggest looking). It would be great if it is 10-15 lines of 
> code, no additional dependencies other than VRPN, and creates nice & smooth 
> movements. Any other hints (I am rather limited on time, so anything is 
> appreciated)?

There is a simple (non-osg-specific) VRPN tuto here:

http://www.vrgeeks.org/vrpn/tutorial---use-vrpn

A callback to update a matrix on an osg::MatrixTrasform from the
quaternion/vector that you get from VRPN is just a copy & paste from
an example in OSG. Or, even simpler, you can do it from the VRPN
callbacks directly, just retrieve the data you want and set it to the
node's matrix.

Just don't forget to run the mainloop() function during the update
traversal of the scenegraph - that is when the above mentioned
callbacks get actually called if there are new data from the VRPN
server. That can be done either in an update callback on some node
somewhere or if you don't mind a bit of a mess in your code, put it in
the main loop, somehow like this:

    while (!viewer.done())
    {
        tkr->mainloop();
        viewer.frame();
    }

That's pretty much all there is to VRPN on the client side. The other
classes (Button, Analog, Dial, etc.) work pretty much the same - open
a remote, register a callback and then call the mainloop() on the
remote.

Regards,

Jan
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to