<div dir="ltr"><div><div><div>Hi Mike,<br><br></div>OK, the next complication is probably that the osg::Texture has the probably unref'd the Image assigned to it after it's download to GL, the method that control it is in include/osg/Texture:<br><br>        /** Sets whether or not the apply() function will unreference the image<br>          * data. If enabled, and the image data is only referenced by this<br>          * Texture, apply() will delete the image data. */<br>        inline void setUnRefImageDataAfterApply(bool flag) { _unrefImageDataAfterApply = flag; }<br><br></div>This is memory optimization, but... if you want to look at the image data after it's been rendered you obviously don't want to use this feature.  By default this feature is OFF, but if you run the osgUtil::Optimizer on the scene graph it can switch it on as a memory optimization.  <br><br>You can switch it back on using the osgUtil::Optimizer::TextureVisitor see the include/osgUtil/Optimizer header for the TextureVisitor.<br><br></div>Robert.<br><div><br> <br><div><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 August 2015 at 20:34, Mike Greene <span dir="ltr"><<a href="mailto:mgreene@hiwaay.net" target="_blank">mgreene@hiwaay.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">OK, fixed that - loaded an .ive file and was able to get correct looking texture coordinates. In a .ive file with embedded textures, is there a textureName? Probably not - not really important.<br>
<br>
But the code does say that there is one image in the texture. But doing the getImage(0) does not return a valid image and thus no color from the texture is returned.<br>
<br>
<br>
Code:<br>
<span class=""><br>
 osgUtil::LineSegmentIntersector::Intersections intersections;<br>
                if (viewer->computeIntersections(ea, intersections))<br>
                {<br>
                        const osgUtil::LineSegmentIntersector::Intersection& hit = *intersections.begin();<br>
<br>
                        //MGREENE<br>
</span>                        std::cout << "hit = " << hit.getLocalIntersectPoint().x() << "," << hit.getLocalIntersectPoint().y() << "," << hit.getLocalIntersectPoint().z() << std::endl;<br>
<br>
                        osg::Vec3 tc(0, 0, 0);<br>
                        osg::Texture* myTexture = hit.getTextureLookUp(tc);<br>
<span class="">                        std::cout << "tc = " << tc.x() << "," << tc.y() << "," << tc.z() << std::endl;<br>
<br>
<br>
</span>                        if (myTexture){<br>
                                std::string myString = myTexture->getName();<br>
                                std::cout << "texturename = " << myString << std::endl;<br>
<br>
                                int numImages = myTexture->getNumImages();<br>
                                std::cout << "numImages = " << numImages << std::endl;<br>
<br>
                                osg::Image *myImage = myTexture->getImage(0);<br>
                                if (myImage) {<br>
                                        osg::Vec4 textureColor = myImage->getColor(tc);<br>
                                        std::cout << "textureColor = " << textureColor.r() << "," << textureColor.b() << "," << textureColor.g() << "," << textureColor.a() << std::endl;<br>
                                }<br>
                    }<br>
                        //END MGREENE<br>
<br>
<br>
<br>
...<br>
<span class=""><br>
Thank you!<br>
<br>
Cheers,<br>
Mike<br>
<br>
------------------<br>
Read this topic online here:<br>
</span><a href="http://forum.openscenegraph.org/viewtopic.php?p=64908#64908" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=64908#64908</a><br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
</div></div></blockquote></div><br></div>