[osg-users] CompositeViewer context cleanup and missing textures

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Tue Nov 24 07:05:31 PST 2009

Hi Frederic,

> Since we don't have direct access to the textures, we can't make the call to setUnRefImageDataAfterApply(). Would there be another way?

You can run a visitor to get to the textures and turn this setting off. 
You can either make your own, or use osgUtil::Optimizer::TextureVisitor 
like this:

osg::Node* node = osgDB::readNodeFile(...);
osgUtil::Optimizer::TextureVisitor tv(true, false, false, false, false, 

(the arguments to TextureVisitor's constructor are "changeAutoUnRef", 
"valueAutoUnRef", and the rest all false so nothing else is changed.)

> Now, as for the modified CompositeViewer example, I tried it on Windows Vista and it simply crashes the first time I hit ESC or the X button. 

Strange, I tried it on Vista as well and I didn't have any problem. I 
notice you're using the stable version of OSG (osg55 = OSG 2.8, the 
current SVN trunk is at 62), so perhaps something was fixed that affects 
this, and it would not crash for you in a more recent version.

Hope this helps,

Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com

More information about the osg-users mailing list