The problem is now resolved.
I have many tabs displaying the same scene graph in my application. One
of the tab had a broken (NaN) projection matrix because of a nice window
resize to a [0,0] dimension on creation (thanks Qt!) I was using a
second tab with a second osgViewer, without caring too much about the
first one.
The problem is that the two viewers were using the same scene graph, and
the intersection test seems to be done between the first (broken) viewer
cull and the second (correct) viewer cull traversal. Thus the bounding
sphere of the AutoTransform object was invalid when doing the
intersection test, because computed using the broken projection matrix.
The TrackballDragger was correctly displayed because the AutoTransform
was "fixed" in the second viewer cull traversal, using the correct
projection matrix, before rendering (or at least, that's what I assume).
I admit this use of many viewers on the same scene graph is not clean,
but it is a test application. At least I fixed the broken viewer by not
resizing its window down to [0,0]. I suppose there is an easy way to
share the same scene graph between many viewers without clashing on
view-dependent objects like this?
regards,
Vincent Gadoury
Vincent Gadoury wrote:
Hi,
I have a problem with picking a dragger when an AutoTransform is
active. In fact, the problem occurs with any LineSegmentIntersection
with objects inside an AutoTransform. I can resume my case to using
the osgManipulator::TrackballDragger with useAutoTransform=true.
Basically, I create a TrackballDragger and add it as a child of the
root node (just to test), then run an intersection test when I click
(as in the osgManipulator example):
view->computeIntersections(ea.getX(),ea.getY(),intersections)
If I create the Trackball with useAutoTransform=false, everything
works fine, it gets intersected and highlights. But if I create the
trackball with useAutoTransform=true, it never intersects. In fact,
IntersectionVisitor::apply(osg::Transform& transform) is never called.
The trackball displays correctly.
I've tested with a really basic application (based on the
osgManipulator example) and it works fine:
int main()
{
osgViewer::Viewer viewer;
osg::ref_ptr<osg::Group> loadedModel = new osg::Group;
osg::ref_ptr<osgManipulator::TrackballDragger> dragger = new
osgManipulator::TrackballDragger(true);
dragger->setupDefaultGeometry();
loadedModel->addChild(dragger);
viewer.setSceneData(loadedModel.get());
viewer.addEventHandler(new PickModeHandler()); // From
osgmanipulator example.
return viewer.run();
}
My application does about the same thing (except being more complex of
course). So obviously I'm missing something in my application, or
doing something wrong. And I can't catch what it is.
Does somebody have a clue about what can make an intersection test not
work with an auto-transformed object? I understand that it's hard to
tell without seeing the specific application's code, but to me the
application is quite straightforward.
I'm currently using OSG version 2.9.2.
regards,
Vincent Gadoury
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org