Hello all,
I got a problem with osgUtil::computeIntersections(). I wanted to include it in
my application (which is nested into the osgviewerQT example). I took the code
for picking from the osgpick example.
However, when I click on my view, there's the following possibilities
- the picked node/drawable is correct, but listed twice
- no intersection is computed, although I clicked on a drawable
- an intersection is computed, although i clicked into empty space
I can't explain, what I could be doing wrong. Perhaps it's that event comes
from QMouseEvent and has another coordinate system than osgviewer?
Any hints where to go from here?
Best wishes
Hartmut
Code:
void ViewerQT::mouseReleaseEvent( QMouseEvent* event )
{
// default mouse control
AdapterWidget::mouseReleaseEvent(event);
// continue with picking
osgUtil::LineSegmentIntersector::Intersections intersections;
float x = event->x();
float y = event->y();
std::cout << "(" << x << "," << y << ")";
std::cout << std::endl;
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
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org