Hi, Andreas

   here a bit of code, which you will have to adjust to your setup (meaning

> that I use a GUI and you use a Viewer, where Functions for retrieving
> the mouse are different):



/************************************************************************/

    //Here you get the mouse, you will have to do this differently
>     int lastx = event.GetX();
>     int lasty = event.GetY();
>     //Here you get the size of your viewport, you will have to do this
> differently:
>     int w=0; int h=0; GetSize(&w, &h);
>     //Here I normalize the mouse to floats between -1 and 1
>     float x = -1.0f + (float)(2*(lastx))/(float)w;
>     float y = -1.0f + (float)(2*(h -lasty))/(float)h;



/***********************************************************************/

       I've substituted the above with float x = ea.getXNormalized();, I've
figured it would be the same.

    /**********************************************************************/

    //You will have to do this slightly differently, using the
> corresponding functions of your viewer:
>     osg::Matrix pm = sceneView->getProjectionMatrix();
>     osg::Matrix vm = sceneView->getViewMatrix();


     /*********************************************************************/


        About the your commentary right above: I've searched thoroughly in
the doxygen documentation and I haven't found any method equivalent to
getProjectionMatrix, in osgUtil::SceneView, in osgViewer::Viewer. Is there a
way to transfer the data from the viewer to SceneView and then use
getProjectionMAtrix(). For example getting scene data from the same root
node?

    Thanks,

      Renan M Z Mendes
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to