Re: [osg-users] setViewMatrixAsLookAt in Qt

2012-02-23 Thread Chris Blizniak
Hi,

Thanks for your reply Tom, I changed few things in my code, and I'm no longer 
using osgviewerQt. I tried different approach, much simpler - something similar 
to:
https://gitorious.org/mahjong-night/mahjong-night/blobs/master/mahjong-night/client/tablewidget.cpp

Using slots and signals was pretty straight forward in this case.

Thank you!

Cheers,
Chris

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45716#45716





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


Re: [osg-users] setViewMatrixAsLookAt in Qt

2012-02-22 Thread Tom Pearce
Hi Chris,

Can you give a bit more info about what you've tried and why it isn't working?

I haven't worked with osgViewerQt before, but it looks like it inherits from 
osgViewer::Viewer, runs in single threaded mode, and frame() is called by the 
paintGL method, which is presumably triggered by the QApplication's event loop. 
 In this case, it ought to be safe to set the camera position in other events 
in the same loop, such as user interaction through the sliders you want to use.

What I'd recommend is connecting the sliders via the signal/slot mechanism to a 
function you define, which reads the value of each slider and creates an 
osg::Vec3 from them.  This will be your eye vector.  You also will define the 
center vector (the point the camera aims at) and the up vector of the 
camera.

To actually get the camera, use ViewerQT::getCamera() (inherited from 
osgViewer::Viewer).  Then make the call to setViewMatrixAsLookAt with the 
vectors from above.

Hope that helps,
Tom

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=45699#45699





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