Splendid. Thank you.

Kim.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sukender
Sent: 19 November 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
*****************************************************************************************
To view the terms under which this email is distributed, please go to 
http://www.hull.ac.uk/legal/email_disclaimer.html
*****************************************************************************************
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to