thanks Sebastian. Does this piece of code have to be placed in the
beginning of the program during the initialization phase?

I haven"t come across these classes so far... seems to be advanced stuff
that is not even covered in the OSG books...

Christian


2014-12-01 18:10 GMT+01:00 Sebastian Messerschmidt <
[email protected]>:

>  Hi Christian,
>
> Also you could try to activate caching and sharing of nodes/textures:
>
> Here is some snippet from my code:
>
> <snip>
>
>     {
>         osgDB::SharedStateManager::ShareMode mode =
> osgDB::SharedStateManager::SHARE_NONE;// =
> osgDB::SharedStateManager::SHARE_ALL;
>
>         mode = mConfig.mGlobalState.mShareStates ?
> static_cast<osgDB::SharedStateManager::ShareMode>(mode |
> osgDB::SharedStateManager::SHARE_STATESETS) : mode;
>         mode = mConfig.mGlobalState.mShareTextures
> ?static_cast<osgDB::SharedStateManager::ShareMode>(mode |
> osgDB::SharedStateManager::SHARE_TEXTURES) : mode;
>
>
> osgDB::Registry::instance()->getOrCreateSharedStateManager()->setShareMode(mode);
>
>     }
>
>
>     {
>         //setup caching
>         osgDB::Options::CacheHintOptions opts;
>         opts = static_cast<osgDB::Options::CacheHintOptions>(opts
> |osgDB::Options::CACHE_IMAGES);
>         opts = static_cast<osgDB::Options::CacheHintOptions>(opts
> |osgDB::Options::CACHE_NODES);
>
> opt->setObjectCacheHint(static_cast<osgDB::Options::CacheHintOptions>(opts));
>         osgDB::Registry::instance()->setOptions(opt);
>     }
> </snip>
>
> Cheers
> Sebastian
>
>   Hi,
>
> when I use osgDB::readNodeFile on several objects, and those objects all
> reference the same texture file on disk - is it possible to make OSG use
> the same texture on all loaded subgraphs? Currently it seems like I have
> the same texture loaded over and over, consuming precious texture memory
> (and also rescaling the texture to powers of 2 multiple times...)
>
>  Can osgUtil::Optimizer somehow recognize identical texture file names
> and make the entire scene graph use the same texture handles?
>
>  Christian
>
>
>
> _______________________________________________
> osg-users mailing 
> [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
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to