Hi Farshid, Doesn't osgDB::readNodeFile cache textures with: osgDB::ReaderWriter::Options::CacheHintOptions::CACHE_IMAGES?
Zach -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Farshid Lashkari Sent: Tuesday, August 29, 2006 19:51 To: osg users Subject: Re: [osg-users] SharedStateManager? Hi Chris, I use the SharedStateManager to share textures amongst all my loaded models. So I create the manager like so: osg::ref_ptr<osgDB::SharedStateManager> m_textureCache = new osgDB::SharedStateManager; m_textureCache->setShareMode(osgDB::SharedStateManager::SHARE_TEXTURES); There is also a mode to share statesets as well. Whenever I load a model I do the following: m_textureCache->share(node); This command will traverse the node for all textures. If it encounters a new texture it will add it to its cache. If it encounters a texture that is equal to a texture already in the cache then it will replace it with the cached texture. My understanding is that this will ensure that textures loaded from the same file will all use the same OpenGL texture object, instead of creating a new one. Whenever I remove a model from my scenegraph I call the following: m_textureCache->prune(); This will iterate through the texture cache and remove textures that are not being referenced anymore. I think the behaviour is similar when enabling shared stateset mode. -Farshid On 8/29/06, Chris Hanson <[EMAIL PROTECTED]> wrote: > Can anyone give me sort of a starting point to read up on what the > SharedStateManager is and does, and how to use it? > > -- > Chris 'Xenon' Hanson aka Eric Hammil | http://www.3DNature.com/ eric at logrus > "I set the wheels in motion, turn up all the machines, activate the programs, > and run behind the scenes. I set the clouds in motion, turn up light and sound, > activate the window, and watch the world go 'round." -Prime Mover, Rush. > _______________________________________________ > osg-users mailing list > [email protected] > http://openscenegraph.net/mailman/listinfo/osg-users > http://www.openscenegraph.org/ > _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/ _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
