[osg-users] Texture Caching Problem with 3.6.3/4

Robert Osfield robert.osfield at gmail.com
Wed Dec 11 06:13:38 PST 2019


On Wed, 11 Dec 2019 at 13:04, Greg D <g.danaha at networkharbor.com> wrote:

> I don't understand exactly what the cache does.
>

The clue is in the name, ObjectCache is cache of Objects so they can be
reused.

The cache is useful for avoid objects being loaded multiple ties,
especially important for textures as they consume a large amount of GPU
memory so maintaining duplicates can cripple performance.


>   If it has an expiration time and objects are removed after a minute or
> so (which seems to happen) it would appear it is a short-term cache,
> perhaps to increase efficiency when the model is loading,
>

The amount of time objects in cache are retained for is controlled by the
osgDB::Registry::setExpiryDelay(double), it defaults to 10 seconds, you can
set it programmatically or set the default via OSG_EXPIRY_DELAY env var.



> before it is rendered, such as re-using already loaded texture images and
> so forth.  If it is for long-term caching (keeping models in memory even
> after another model is loaded) that would be counter productive in our
> application, since the user might load several different large model files
> in a minute in some situations, and keeping all those models in memory
> would be problematic.  My preference would be to disable caching
> altogether, unless it is a short-term cache to make loading more efficient,
> in which case clearing the cache after the first render solves my problem.
>
> I have set the osgDB::Options to CACHE_NONE but it does not appear to have
> any effect on caching.  The OpenFlight model and its textures are always
> loaded from the cache if the cache contains objects.
>
> osg::ref_ptr<osgDB::Options> dbOptions = new osgDB::Options();
> dbOptions->setObjectCacheHint(osgDB::Options::CACHE_NONE);
>
> osgDB::readNodeFile(fileName, dbOptions);
>
> Is this not the correct way to disable caching?
>

It's a ObjectCacheHint so plugns can be free to ignore the hint if they
want to use the cache for their own requirements.

Robert.

-- 
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to osg-users+unsubscribe at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/CAFN7Y%2BXzTpV%2B5H-x-dU-HSWL%2B80PaDcxTuHB7J3B%3DJgJXsShcQ%40mail.gmail.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191211/9d29b747/attachment-0001.html>


More information about the osg-users mailing list