[osg-users] Crash on exit (graphics thread removing camera)
Jannik Heller
scrawl at baseoftrash.de
Tue Aug 16 07:28:00 PDT 2016
Hi,
>
> The releaseGLObjects() and removeCamera() are there to make sure
> resources are correctly cleaned up. If you really try you can break
> it, like hiding resources from that active parts of the viewer/scene
> graph that are their to clean up things
>
Yes you can break it that way but I'm actually talking about a different breakage - the fact that resources get cleaned up that should *not* be cleaned up because they're still in use.
Consider:
- Camera1
-- Node1
--- Geometry1
- Camera2
-- Node2
--- Geometry1
Now if we remove Camera1, Geometry1 gets releaseGLObjects() even though it's still being used by Camera2. This will result in frame drops because the objects have to be recompiled on the next frame.
This is not a "corner case", doing resource sharing between cameras is something that everyone will do to improve the performance.
My argument is that the releaseGLObjects() in GraphicsContext::removeCamera is so broken that we should simply remove it.
That cleanup shouldn't be necessary anyway because the GL objects are released when objects are destroyed. So if the object was only in use by that Camera (i.e. no other reference to it), the object gets destroyed and releaseGLObjects() after the Camera is destroyed. If there are still references to the object, then the user is obviously still using it so we should not releaseGLObjects() on it.
Cheers,
Jannik
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68391#68391
More information about the osg-users
mailing list