<div dir="ltr"><div>Hi,</div><div><br></div><div>Some examples from the Cookbook (book by Rui Wang & Xuelei Qian) use this code snippet, given at page 39.<br></div><div><br></div><div> class PickHandler : public osgGA::GUIEventHandler<br> {<br> public:<br> // This virtual method must be overrode by subclasses.<br> virtual void doUserOperations( osgUtil::LineSegmentIntersector::Intersection& ) = 0;<br> virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa )<br> {<br> if ( ea.getEventType()!=osgGA::GUIEventAdapter::RELEASE<br> ||ea.getButton()!=osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON<br> ||!(ea.getModKeyMask()&osgGA::GUIEventAdapter::MODKEY_CTRL) )<br> return false;<br> osgViewer::View* viewer = dynamic_cast<osgViewer::View*>(&aa);<br> if ( viewer )<br> {<br> osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector = new osgUtil::LineSegmentIntersector(osgUtil::Intersector::WINDOW, ea.getX(), ea.getY());<br> osgUtil::IntersectionVisitor iv( intersector.get() );<br> viewer->getCamera()->accept( iv );<br> if ( intersector->containsIntersections() )<br> {<br> osgUtil::LineSegmentIntersector::Intersection& result = *(intersector->getIntersections().begin());<br> doUserOperations( result );<br> }<br> }<br> return false;<br> }<br> };<br></div><div><br></div><div>I couldn't compile examples 1 and 2 from chapter 2, and example 1 from chapter 5.</div><div><br></div><div>I'm using Debian 10 and the latest version of OSG. My command to compile the last one is:</div><div><br></div><div>$ g++ cook5.1.cpp -losg -losgAnimation -losgGA -losgUtil -losgViewer -o cook5.1<br></div><div><br></div><div>I get the following error message:</div><div><br></div><div>cook5.1.cpp: In member function ‘virtual bool osgCookBook::PickHandler::handle(const osgGA::GUIEventAdapter&, osgGA::GUIActionAdapter&)’:<br>cook5.1.cpp:72:62: error: binding reference of type ‘osgUtil::LineSegmentIntersector::Intersection&’ to ‘const osgUtil::LineSegmentIntersector::Intersection’ discards qualifiers<br> osgUtil::LineSegmentIntersector::Intersection& result = *(intersector->getIntersections().begin());<br> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br></div><div><br></div><div>The message is the same in the previous examples. Anyone knows what's going on?</div><div><br></div><div>Thanks,</div><div>Rodrigo.<br></div><div><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/f0e93c54-f8aa-4651-bc11-1d22bc626343%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/f0e93c54-f8aa-4651-bc11-1d22bc626343%40googlegroups.com</a>.<br />