[osg-users] Removing objects with shared GL state from scene graph

Robert Osfield robert.osfield at gmail.com
Thu Jul 25 10:00:05 PDT 2019


Hi Chris,

On Thu, 25 Jul 2019 at 17:33, Chris Djali <krizdjali at gmail.com> wrote:

> Annoyingly, while that branch fixes the issue in my examples, it isn't
> fixing it in my actual application.


I guess that's an improvement :-)

This change is in the OpenSceneGraph-3.6 branch and the 3.6.4-rc9 so will
part of the release.


> The cache gets cleared when the application exits (potentially after all
> OpenGL contexts have been closed), but not when views are added to and
> removed from the composite viewer, so I'm still getting the same Warning:
> detected OpenGL error 'invalid value' at after RenderBin::draw(..) message.
> I'm not seeing Renderer::releaseGLObjects get called ever, but I can't tell
> whether it would be called if there was a view active when the application
> was closed, as I'm also battling a Qt bug that causes a crash in that
> situation.
>

Are the Camera's being removed from the Window before it gets closed?  I
have just checked the GraphicsContext::close() method and it calls all the
Camera::releaseGLObjects(), which in turn will call the
Renderer::releaseGLObjects(), which will now call the
ObjectCache::releaseGLObjects().  After calling all the releaseGLObjects()
the GraphicsContext::close() then calls the
osg::deleteAllGLObjects(_state->getContextID())  of the context isn't
shared.

There might be something weird that needs fixing at my end. I can see with
> tracepoints that a pair of Renderers gets constructed when the application
> constructs a View and StatsHandler and they get destroyed when the last
> ref_ptr to the view is destroyed, so the Renderers aren't sticking around
> forever.
>

I don't have your application or test app with similar behavior so can't
add much more.

With the Qt error, it could be that the OSG integration or the OSG itself
isn't doing something perfectly for this usage case so the problem pops in
Qt, it could also be just a Qt bug...

Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20190725/6bcd12d5/attachment.html>


More information about the osg-users mailing list