Your comments will be appreciated,Regards,
From: [email protected]
To: [email protected]
Date: Mon, 4 Aug 2014 10:18:39 +0100
Subject: [osg-users] Erratical  behaviour with PolytopeIntersector




Dear All,
I'm experiencing very weird problem when using the polytope intersector. Since 
there is not any explicit example on how to use polytope example with 
rectangular selection I use osgPick example in OSG and modify the codes to suit 
my need.
Normally the below code picks the objects on scene but shows that 400 picked 
objects which is not correct and far beyond of scene object range where that I 
have, I only have 5-6 object in scene, 
What could be the reason of that malfunctioning ? I 'll appreciate your 
guidance on that !.
case (osgGA::GUIEventAdapter::RELEASE):            {                if 
(btn_counter == 1 )                {                    firstX = ea.getX(); 
firstY = ea.getY();                    btn_counter = 2;                    
break;                }
                if (btn_counter==2)                {                    
btn_counter = 1;                    osgUtil::PolytopeIntersector* polytop = new 
osgUtil::PolytopeIntersector( osgUtil::Intersector::WINDOW,  firstX,firstY, 
ea.getX(), ea.getY() );                    osgUtil::IntersectionVisitor 
iv(polytop);                    view->getCamera()->accept(iv);
                    int k;                    if 
(polytop->containsIntersections() )                    {
                             osgUtil::PolytopeIntersector::Intersections 
intersections= polytop->getIntersections();                             
osg::Vec3 screenpos = osg::Vec3(ea.getX(),ea.getY(),0);
                             
for(osgUtil::PolytopeIntersector::Intersections::iterator hitr = 
intersections.begin();                                hitr != 
intersections.end(); ++hitr)                             {                      
           k+=1;                                std::cout<< k << "----" << 
hitr->drawable->getName()<< hitr->drawable->className()<<"\n" ;
                             }                    }                }            
}        }    }};
                                                                                
                                                                                
  

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

Reply via email to