Hi All,
I'm trying to handle mouse movements to show some informations to the user.
I have basically two questions.

1) Lookig at "osgkeyboardmouse.cpp" example found the following code:

Code:

            if (_useWindowCoordinates)
            {
                // use window coordinates
                // remap the mouse x,y into viewport coordinates.
                osg::Viewport* viewport = viewer->getCamera()->getViewport();
                double mx = viewport->x() + (int)((double 
)viewport->width()*(ea.getXnormalized()*0.5+0.5));
                double my = viewport->y() + (int)((double 
)viewport->height()*(ea.getYnormalized()*0.5+0.5));

                // half width, height.
                double w = 5.0f;
                double h = 5.0f;
                picker = new osgUtil::PolytopeIntersector( 
osgUtil::Intersector::WINDOW, mx-w, my-h, mx+w, my+h );
            } else {
                double mx = ea.getXnormalized();
                double my = ea.getYnormalized();
                double w = 0.05;
                double h = 0.05;
                picker = new osgUtil::PolytopeIntersector( 
osgUtil::Intersector::PROJECTION, mx-w, my-h, mx+w, my+h );
            }



Is there a casa in which osgUtil::Intersector::WINDOW option is preferred with 
respect to osgUtil::Intersector::PROJECTION?

2) osgUtil::LineSegmentIntersector does not seem to work fine if the geometry 
is a line created with:

   osg::Vec3Array* vertices = new osg::Vec3Array;
   ...
   osg::DrawElementsUInt* elements = new 
osg::DrawElementsUInt(osg::PrimitiveSet::LINE_STRIP);
   geometry->setVertexArray(vertices);
   geometry->addPrimitiveSet(elements);

In this case when I move the mouse over that geometry I get 
containsIntersections() = false.
Could you please explain me why?

Regards,
Gianni

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61492#61492





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to