Hi Yefei,

I do this in my code:

        osgDB::ReaderWriter::Options* opt = new osgDB::ReaderWriter::Options;
        opt->setObjectCacheHint( osgDB::ReaderWriter::Options::CACHE_IMAGES );
        osgDB::Registry::instance()->setOptions( opt );

which seems to solve the problem you describe. I am not sure why your method 
would not work.

Doug

On Jun 27, 2012, at 7:03 PM, He, Yefei wrote:

> Hi, Robert,
>  
> I’m working on an application that loads multiple ive files and the memory 
> usage gets quite high. A lot of these ive files share textures. It appears 
> that the image files for these textures gets loaded multiple times. For 
> example, if I just run “osgviewer cow.osg cow.osg”, the reflect.rgb file gets 
> loaded twice. Is there any consideration to cache the images to reduce memory 
> usage? There is a ReaderWriter option  CACHE_IMAGES. However, I don’t think 
> it is actually being recognized by any of the image reader plugins. At least 
> not by the jpeg or rgb plugins, I believe. Is the mechanism in place to 
> actually cache images? Any examples I can refer to?
>  
> Thanks,
>  
> Yefei
>  
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to