[osg-users] Removing objects with shared GL state from scene graph
Robert Osfield
robert.osfield at gmail.com
Fri Jul 26 02:24:43 PDT 2019
Hi Chris,
On Fri, 26 Jul 2019 at 00:38, Chris Djali <krizdjali at gmail.com> wrote:
> I have more information. The GraphicsContext is only referenced by the
> camera when the camera is destroyed. The camera detaches itself from the
> graphics context in its destructor, then the camera's ref_ptr to the
> graphics context is destroyed, triggering the destruction of the graphics
> context. The graphics context calls its own close in its destructor, but by
> then the camera has already detached itself, so it's not helpful.
>
I don't recall the reason for the current form of the Camera destructor,
it's current incarnation is:
Camera::~Camera()
{
setCameraThread(0);
if (_graphicsContext.valid()) _graphicsContext->removeCamera(this);
}
So if the GraphicsContext hasn't already been closed then the removeCamera
above would prevent the releaseGLObjects() being called on the Camera.
So... would change the destructor to:
Camera::~Camera()
{
setCameraThread(0);
if (_graphicsContext.valid())
{
releaseGLObjects(_graphicsContext->getState());
_graphicsContext->removeCamera(this);
}
else
{
releaseGLObjects();
}
}
Work for your usage case?
Robert.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190726/874a1ec8/attachment.html>
More information about the osg-users
mailing list