Hi again, I have integrated an OSG viewer in an existing application and have 
gotten the viewer to display a model correctly. I now wanted to implement some 
picking, and I have been using the osgkeyboardmouse example for this.
My problem is that whenever I click on something the deconstructor for 
"intersection" causes a "Heap pointer out of local" error when "intersection" 
goes out of scope.

The code snippet is the following (from osgkeyboardmouse):
---------------

osgUtil::IntersectionVisitor iv(picker);

viewer->getCamera()->accept(iv);

if (picker->containsIntersections())

{

osgUtil::LineSegmentIntersector::Intersection intersection = 
picker->getFirstIntersection();

osg::notify(osg::NOTICE)<<"Picked 
"<<intersection.localIntersectionPoint<<std::endl;

osg::NodePath& nodePath = intersection.nodePath;

node = (nodePath.size()>=1)?nodePath[nodePath.size()-1]:0;

parent = 
(nodePath.size()>=2)?dynamic_cast<osg::Group*>(nodePath[nodePath.size()-2]):0;

if (node) std::cout<<" Hits "<<node->className()<<" nodePath 
size"<<nodePath.size()<<std::endl;

toggleScribe(parent, node);

}

-----------------
I have tried integrating the osgkeyboardmouse in the osgviewermfc example, and 
there it works fine, so I'm mostly suspecting that the problem lies with my 
existing application, but if anyone have tried anything similar I would like to 
hear any ideas you might have.

Regards,

Jesper D. Thomsen
<mailto:[EMAIL PROTECTED]>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to