Hi Robert, Thank you for the clarifications.
Regards, Rick -----Original Message----- From: osg-users [mailto:[email protected]] On Behalf Of Robert Osfield Sent: Wednesday, June 8, 2016 10:54 AM To: OpenSceneGraph Users <[email protected]> Cc: Xing Gao <[email protected]> Subject: Re: [osg-users] Use of getCameraContainingPosition in OSG 3.4.0 (deprecated?) Hi Rick. I deprecated the function as the interpretation of how it should behave is ambiguous for certain combinations of viewer Camera set up - it simply can't guarantee to give the correct camera and x,y location that you might be expecting as the interface doesn't provide enough information for the function to work correctly in all cases as it has to make assumptions for this missing data. For simple viewers you won't hit up against this but as you add more complex set ups set as multiple overlapping cameras/distortion correction etc. exactly how a mouse coordinate maps can varying widely. The resolve the task of where a mouse coordinate maps osgGA::GUEventAdapter now "has a" stack of PointerData that hold how the coordinate maps to the successive camera's in the stake. If you look at View you'll now see computeIntersections(..) methods that take the GUIEventAdapter object directly rather than the orphaned x,y mouse cooridnates. This extra information enables the intersection traversal correctly. The PonterData holds the Camera information, if you look at the View::computeIntersections(..) methods you'll see how it's used: bool View::computeIntersections(const osgGA::GUIEventAdapter& ea, osgUtil::LineSegmentIntersector::Intersections& intersections,osg::Node::NodeMask traversalMask) { #if 1 if (ea.getNumPointerData()>=1) { const osgGA::PointerData* pd = ea.getPointerData(ea.getNumPointerData()-1); const osg::Camera* camera = pd->object.valid() ? pd->object->asCamera() : 0; if (camera) { return computeIntersections(camera, osgUtil::Intersector::PROJECTION, pd->getXnormalized(), pd->getYnormalized(), intersections, traversalMask); } } #endif return computeIntersections(ea.getX(), ea.getY(), intersections, traversalMask); } The old code is still there as a fallback, the new bit is in the #if 1 #endif block. I realise this will seem like an extra level of complexity, but for most users they shouldn't be using the getCameraContainingPosition() method directly and won't need to look at the PointerData either. What the PointerData gives you is a robust way of getting the mouse position relative to the active cameras. Robert. Robert. On 8 June 2016 at 15:34, Rick Irons <[email protected]> wrote: > Hi, > > > > We are working on updating an application from OSG 3.0.1 to 3.4.0. We > have previously relied on getCameraContainingPosition() for selection, > but now we are noticing that the function is marked as deprecated. > Can someone identify the deprecation plan for this API? Is it still > safe to use with the understanding that it will not be available in a > future release? Or, should we stop using the function now? Our > efforts to locate information on the deprecation of this API have not been > successful. > > > > I am asking since the function is not behaving as expected following > our update. It is not clear if this behavior is due to the function > no longer being supported or if some changes on our end are necessary > to use the 3.4.0 version of the API. > > > > Thanks for any help you can offer. > > > > Rick > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. > org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

