[osg-users] Texture Caching Problem with 3.6.3/4
Robert Osfield
robert.osfield at gmail.com
Mon Dec 16 09:08:33 PST 2019
Hi Greg,
Today I worked on improving the ObectCache::releaseGLObjects()
implementation so that it removes objects in the scene that are Texture or
contain Textures in their subgraph, where the Texture no longer have any
associated osg::Image. I believe this resolves the usage case :
1. Load the scene graph, with the Texture UnRefImageAfterApply setiings
are set to UnrefImageAfterApply, with the loaded textures/scene graphs
being cached in the osgDB::ObjectCache.
2. Render the scene graph, resulting the in the scene graph images being
unref'd from their Textures.
3. Close the Window, which cleans up the scene graph GL obects by calling
releaseGLObjects()
4. Load a new scene graph with textures/objects loaded from disk and
where possible from the ObjectCache if previously loaded and cache, Got
back to 2. (Rendering etc.)
I created an example that follows all these steps and it reproduced the
problem with the textures appearing black on the second time around when
loading an OpenFlight database. With the fixes to
ObjectCache::releaseGLObjects() the unref'd images are automatically
removed from the cache as part of step 3. above, so that they aren't shared
any more, instead new copies are loaded from disk with their image in place.
This fix is checked into the OpenSceneGraph-3.6 branch. The commit is:
https://github.com/openscenegraph/OpenSceneGraph/commit/9ae47b921b2184788e6efe85692908bd0ba900a2
Could you please test this out. You should be able to remove your own
manually clearing of the ObjectCache now, as it will be done automatically
when required.
Cheers,
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/f779a1bf-e231-4317-8600-565dca7f4670%40googlegroups.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20191216/1752db61/attachment.html>
More information about the osg-users
mailing list