Hi LiTing, Have a look at the osgpick and osgkeyboardmouse examples, they'll show you how to set up picking in different ways.
Also to understand transformation between window coordinates and world coordinates it'd be worth you reading OpenGL docs on gluUnproject and gluProject. The basic concept of the transformation involved are: To go from world to window coords: Matrix VPW = camera->getViewMatrix() * camera->getProjectionMatrix() * camera->getViewport()->computeWindowMatrix(); Vec3 window = world * VPW; To go from window into to world: Matrix inverseVPW; inverseVPW.invert(VPW); Vec3d world = window * inverseVPW; Robert. On 7/13/07, litingbaotou <[EMAIL PROTECTED]> wrote:
Hi, I use OSG 2.0 now, and it's much better than other versions. But I meet a problem when I want to unproject my clicked point from screen to the world scene. In OSG 1.0, I use osgUtil::SceneView::getViewport() to get current viewport matrix and use osgUtil::SceneView::projectWindowXYIntoObject() to get the near point and far point, then I can use them to get a linesegment to intersect with any plane. In OSG 2.0 I use osgViewer::Viewer, I can use osgViewer::Viewer::getCamre()->getViewport() to get current viewport matrix, but I don't know how to use some unproject function like projectWindowXYIntoObject(). I find osgViewer::Viewer has _sceneViews as a osgUtil::SceneView member, but I can not find and "getSceneView()" method in osgViewer::Viewer. Can someone give me a hand? Thanks. --LiTing. ________________________________ litingbaotou 2007-07-13 _______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list osg-users@openscenegraph.net http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/