Hi Nick Thanks for the entrypoint, I usually get intimidated by the these tasks where you are supposed to deal both with raw OpenGL and OSG codes because you have to be fully familiar and grasp the terminology behind of them both. As a next step where am I supposed to place those integrated code portion which handles picking, into mousemove event handler or something else? As further step, picking will return something primitive, data set (vertices, normals , name of primitives)object, something but will it be known to the OSG-engine in terms of OSG arhcitectural terminology? Regards, Date: Sat, 5 Jul 2014 09:16:58 +0200 From: [email protected] To: [email protected] Subject: Re: [osg-users] What is the Object picking criteria in OSG
Hi Sonya, I faced the same challenge while back and was able to resolve it by using the OpenGL selection buffer. Here it is described how: http://www.opengl.org/archives/resources/faq/technical/selection.htm Nick On Sat, Jul 5, 2014 at 9:00 AM, Sonya Blade <[email protected]> wrote: Dear All, I noticed that when one tries to pick an object from scene there is a critera for that, I directly started the example from osgPicking example shown at the officail Osg site.The code which generates the grids in scene are as follow, problem with this is that PickHandler doesn't detect each line as individual entity. I can understand the behaviour of having all the vertices and lines stuffed under the DrawImplementation to increase the performance and PickHandler not detecting them, But If you create each line as individual osg::Geometry then PickHandler must detect them which will result in obvious performance penalty. I tried both osgUtil::LineSegmentIntersector and view->computeIntersections(x,y,intersections) functions if any of them intersects with scene objects, but none of them worked. osg::Geode* CreateGrid(osg::Group* gr, int x, int y, int step){ osg::Geode* gode = new osg::Geode(); for (int j=1; j<2000; j++) { osg::Geometry* linesGeom = new osg::Geometry(); osg::Vec3Array* vertices = new osg::Vec3Array(100 ); for (int i=0;i<50 ;i++ ) { (*vertices)[2*i].set(-100, step+i*10, 40); (*vertices)[2*i+1].set(100, step+i*10, 40); }; linesGeom->setVertexArray(vertices); // set the colors as before, plus using the above osg::Vec4Array* colors = new osg::Vec4Array; colors->push_back(osg::Vec4(1.0f,1.0f,0.0f,1.0f)); linesGeom->setColorArray(colors); linesGeom->setColorBinding(osg::Geometry::BIND_OVERALL); // set the normal in the same way color. osg::Vec3Array* normals = new osg::Vec3Array; normals->push_back(osg::Vec3(0.0f,-1.0f,0.0f)); linesGeom->setNormalArray(normals); linesGeom->setNormalBinding(osg::Geometry::BIND_OVERALL); linesGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINES,0,100)); gode->addDrawable(linesGeom); } return gode;} Regards, _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick _______________________________________________ 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

