Hi, Doug,

    Thanks very much for the tips. I will give it a try. After I sent my last 
email, I also noticed that the option for caching was handled at the registry 
level, before it got down to the functions in the reader plugins that actually 
read the image files.

    Best Regards,

    Yefei

-----Original Message-----
From: osg-users-boun...@lists.openscenegraph.org 
[mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Doug McCorkle
Sent: Wednesday, June 27, 2012 9:35 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Caching images

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
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to