Hi Kim, Well, if you "load" a model with its textures, the function will simply return to you a pointer to an already existing model and/or texture (if cache is enabled). Then if all models of your scene share the same texture and/or vertex arrays, I guess (I'm not 100% sure though) this will do what you expect: texture and/or vertex array are only sent to video memory once.
Also be sure to create COPIES of the vertex arrays, matrix transforms (and other things) if you plan to modify them. Else you would modify the cached shared ressource (this happened to me! I saw all my models being transformed the same way at the same time...). Anyway, caching is a good thing for performance and RAM usage if your models or textures are duplicated in the scene. Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ Le Thu, 20 Nov 2008 08:36:31 +0100, Kim C Bale <[EMAIL PROTECTED]> a écrit: > I've been pondering this Database pager. It only caches the image files into > memory to prevent loading during runtime doesn't it? Those are then used to > build textures on the card memory. > > Is there anything to deal with loading textures onto the graphics card, > dishing out texture IDs rather than reloading the texture onto card memory? > > Kim. > > ________________________________ > > From: [EMAIL PROTECTED] on behalf of Sukender > Sent: Wed 19/11/2008 15:53 > To: OpenSceneGraph Users > Subject: Re: [osg-users] Texture Management > > > > Hi Kim, > > You may just use the osgDB::Registry cache. That's automatic :) > For instance, set the cache by writing: > osgDB::ReaderWriter::Options* rwoptions = new > osgDB::ReaderWriter::Options; > > rwoptions->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL); > osgDB::Registry::instance()->setOptions(rwoptions); > > This will cache everything loaded with readNodeFile() or readImageFile(). > For my use, I preload things in the cache by calling: > osgDB::Registry::instance()->addEntryToObjectCache(path, > osgDB::readNodeFile(path)); > > And I set the cache to never unload: > osgDB::DatabasePager * pPager = viewer.getDatabasePager(); > assert(pPager); > osgDB::Registry::instance()->setDatabasePager(pPager); > pPager->setExpiryDelay(DBL_MAX); > pPager->setExpiryFrames(INT_MAX); > > Also, you could clear the cache by calling: > osgDB::Registry::instance()->clearObjectCache(); > > Hope it will help. > > Sukender > PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ > > > Le Wed, 19 Nov 2008 16:28:25 +0100, Kim C Bale <[EMAIL PROTECTED]> a écrit: > >> I have a number of different models in OSG format that all use the same >> texture. >> >> >> >> What I want to avoid is having duplicate textures loaded onto the >> graphics card when I load these separate models. In previous programs I >> have achieved this using a Texture Manager that manages all texture >> loading i.e. loading the texture once when required and then dishing out >> the texture ID on subsequent requests. A fairly standard practice. >> >> >> >> Is there something similar already built into the OSG? The >> TextureAtlasBuilder in osgUtil sounds looks like it might do something >> similar but I'm not 100% sure, there is very little documentation on it. >> >> >> >> Thanks all. >> >> >> Kim. > > _______________________________________________ > 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

