Thanks Chris,
inverting the y-coordinate did the trick! Picking is now super easy and
correct. And I suppose you're right with the twice listed objects.
Thanks again
Hartmut
Here's the new Code for anyone with the same problem:
void ViewerQT::mouseReleaseEvent( QMouseEvent* event )
{
// default mouse control
AdapterWidget::mouseReleaseEvent(event);
// continue with picking
osgUtil::LineSegmentIntersector::Intersections intersections;
float x = event->x() * 1.0;
float y = height() - event->y();
if (computeIntersections(x,y,intersections))
{
for(osgUtil::LineSegmentIntersector::Intersections::iterator
hitr = intersections.begin();
hitr != intersections.end();
++hitr)
{
if (!hitr->nodePath.empty() &&
!(hitr->nodePath.back()->getName().empty()))
{
// the geodes are identified by name.
std::cout << " Object \""
<<
hitr->nodePath.back()->getName()
<< "\""
<< std::endl;
}
else if (hitr->drawable.valid())
{
std::cout << " Object \""
<< hitr->drawable->getName()
<< "\""
<< std::endl;
}
}
}
}
--
frag nicht - du könntest eine antwort erhalten
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org