Hello Zach,

If I'm not mistaken the sharedStateManager is sort of an automagically working thing. So if the share mode for textures for instance is set, the scene graph will share texture objects which are the same (i.e. if you load a model twice).
The same goes for states.


In my  project I use the sharedStateManager like this:

osgDB::SharedStateManager::ShareMode mode = osgDB::SharedStateManager::osgDB::SharedStateManager::SHARE_STATESETS | osgDB::SharedStateManager::SHARE_TEXTURES; osgDB::Registry::instance()->getOrCreateSharedStateManager()->setShareMode(mode);

Also I use object caching, which will cache identical objects:

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);

But be carefull with the last one. It will indeed share those objects, so If you need to have separate instances (e.g. with own switches or DOFs) you should not cache nodes for instance.


Hope that helps.
cheers
Sebastian
(I apologize for the double thread, but my last thread got taken over by people 
unfamiliar with the email reply system... hopefully I can get some on topic 
help now, I would really appreciate it.)

Hello,

I have been trying to find information on how to use osgDB::SharedStateManager 
to optimize our program, but I have been unable to find anything concrete.
Here is my situation: I have a very large project that utilizes OSG 3.0 
heavily. I want to implement SSM to optimize the project (I understand that it 
does this by finding similar graphics and spitting them all out, then moving on 
to the next type). I'd like to start a conversation on the basics of SSM and 
where to start with it, maybe there is a good resource you know of or have 
implemented it in your own programs. I have tried searching Google and these 
forums, but to no avail.

Thank you in advance!

Regards,
Zach

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=49137#49137





_______________________________________________
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