[osg-users] "LOS" materail query

Sebastian Messerschmidt sebastian.messerschmidt at gmx.de
Tue Aug 25 14:44:04 PDT 2015


Hi,


> Hi,
>
> using the example, osgparticleeffects.cpp, I added the following lines of code to the pick function (inside the //MGREENE section):
>
>
> Code:
>
> void pick(osgViewer::Viewer* viewer, const osgGA::GUIEventAdapter& ea)
>      {
>          osg::Group* root = dynamic_cast<osg::Group*>(viewer->getSceneData());
>          if (!root) return;
>          
>          osgUtil::LineSegmentIntersector::Intersections intersections;
>          if (viewer->computeIntersections(ea,intersections))
>          {
>              const osgUtil::LineSegmentIntersector::Intersection& hit = *intersections.begin();
>
>            //MGREENE
> 			std::cout << "hit = " << hit.getWorldIntersectPoint().x() << "," << hit.getWorldIntersectPoint().y() << "," << hit.getWorldIntersectPoint().z() << std::endl;
> 			
> 			osg::Vec3 tc(0,0,0);
> 			osg::ref_ptr<osg::Texture> myTexture = hit.getTextureLookUp(tc);
> 			std::cout << "tc = " << tc.x() << "," << tc.y() << "," << tc.z()<< std::endl;
> 			//END MGREENE
>
>              bool handleMovingModels = false;
> ...
>
>
>
>
> but the values of tc are always 0,0,0.
Have you checked the return value of the getTextureLookUp call? 
Documentation states that it will return a nullptr if no texture is 
available.
If this doesn't help, debugging into the function might help ;-)

Cheers
Sebastian
>
> Thank you!
>
> Cheers,
> Mike[/code]
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=64894#64894
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




More information about the osg-users mailing list