<div dir="ltr"><div><div><div><div><div>Hi Dan,<br><br></div>It could be that UnRefImageDataAfterApply is being set to true in preprocessing of the data. Are you loading the data from an OSG native format (ive, osg, osgb, osgx,osgt) that you are previously converted from a source format? This processing may have set the UnRefImageDataAfterApply to true.<br><br></div>To reset the value back to false you can use the osgUtil::Optimizer::TextureVisitor, note it's constructor where you can pass in what settings you want to change and the value:<br><br> class OSGUTIL_EXPORT TextureVisitor : public BaseOptimizerVisitor<br> {<br> public:<br><br> TextureVisitor(bool changeAutoUnRef, bool valueAutoUnRef,<br> bool changeClientImageStorage, bool valueClientImageStorage,<br> bool changeAnisotropy, float valueAnisotropy,<br> Optimizer* optimizer=0):<br> BaseOptimizerVisitor(optimizer, OPTIMIZE_TEXTURE_SETTINGS),<br> _changeAutoUnRef(changeAutoUnRef), _valueAutoUnRef(valueAutoUnRef),<br> _changeClientImageStorage(changeClientImageStorage), _valueClientImageStorage(valueClientImageStorage),<br> _changeAnisotropy(changeAnisotropy), _valueAnisotropy(valueAnisotropy) {}<br><br></div>You can simply create this visitor standalone with the settings you want and apply to your scene graph.<br><br></div>No other parts of the OSG set the UnRefImageDataAfterApply - do a search of the OSG to confirm this yourself. The other way is to simply put a breakpoint into osg::Texture::setUnRefImageDataAfterApply() to spot when and where it's being set.<br><br></div>Robert.<br><div><div><div><div><br><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 8 October 2015 at 21:40, Dan Flickinger <span dir="ltr"><<a href="mailto:dmflickinger@gmail.com" target="_blank">dmflickinger@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Robert,<br>
<br>
Thank you very much for the swift reply. Good point on switching to PolytopeIntersector. Another part of the project is already using that for something else. LineSegmentIntersector is finding intersections, so at least it's assumed to work okay for now. I'll definitely switch over once I get this piece working.<br>
<br>
I did find an instance of osgUtil::Optimizer in the code, and I disabled it. The images are still dereferenced in the textures though. In checking each texture with osg::Texture::getUnRefImageDataAfterApply(), it's still set to true. Is there anything else that would enable this aside from running the optimizer?<br>
<br>
I found where each model has its osg::Node initialized, but I'm at a loss in pulling out references to the textures from that. (In order to call setUnRefImageDataAfterApply() there.) Do I need to dig through the attribute list to find a state attribute that is a texture? I'm concerned that if I call setUnRefImageDataAfterApply() at initialization, it will still get reset to true by something else.<br>
<br>
Thanks for all the help!<br>
<span class=""><br>
Best regards,<br>
<br>
Dan<br>
<br>
------------------<br>
Read this topic online here:<br>
</span><a href="http://forum.openscenegraph.org/viewtopic.php?p=65330#65330" rel="noreferrer" target="_blank">http://forum.openscenegraph.org/viewtopic.php?p=65330#65330</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>