[osg-users] How to grab color from a point on a model?

Dan Flickinger dmflickinger at gmail.com
Wed Oct 7 07:31:28 PDT 2015


Hi all,

I recently took over maintaining a system utilizing osg, which simulates sensors on an autonomous vehicle. One of the features in the works is to model a new LIDAR sensor. The system grabs intersections of line segments approximating laser pulses, pulling points into osgUtil::LineSegmentIntersector::Intersection objects. Now these intersections are used to generate simulated point clouds, and I am attempting to model intensity in these points by approximating the color of the model at the intersection point. So this is where I run into a wall.

I get an osg::Texture pointer from osg::Util::LineSegmentIntersector::Intersection.getTextureLookUp(osg::Vec3), which is an osg::Texture2D. This pulls the texture as expected. From there, I attempt to pull out an osg::Image* out of osg::Texture2D.getImage(0). All I'm getting from that is a bunch of NULLs; on multiple models.

My working theory is that _image is never getting set in the Texture2D object, or is that set right before getting handed over to OpenGL, and then unset as the images are deleted in order to not drag around a bunch of cruft? So is there a way to retain the images after loading the models? Or is there a better way to go about grabbing the color of a point on a model? Does texture compression play a part in this? I assume that compressed textures would just return garbage, not have _image set as NULL.

Best regards,

Dan

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








More information about the osg-users mailing list