Hi Chris,

thanks for pointing me to the right direction. Unfortunately, it
didn't work as expected, probably because I still don't get things
right in my head ;)

However, I found a workaround that works quite well: I simply destroy
my viewer before I get a context loss. I can still keep my scene so
everything looks as before leaving the app. When going back into the
application, I simply create a new viewer and everything works smooth
:)

Best regards,
Martin



Am Mi., 24. Juli 2019 um 03:28 Uhr schrieb Chris Djali <krizdj...@gmail.com>:
>
> Hi,
>
> You can't release objects that belong to a destroyed context, so you 
> definitely need to call all the releaseGLObjects methods before the context 
> is destroyed. You shouldn't need to call it on the root node provided the 
> root node is still attached to the viewer when the viewer and context are 
> destroyed, as the normal viewer does this for you.
>
> You need to give the state associated with the context that's being destroyed 
> if you just want to clear GL objects for that context. If you're fine 
> deleting things from every context (e.g. because you've only got one context 
> or destroy them all at once) you can just pass a null pointer, and it'll do 
> it for all contexts.
>
> flushAllDeletedGLObjects gets called automatically unless you're using a 
> weird viewer (which is possible given that you're using Android, but I'd 
> guess it isn't happening).
>
>
>
> If I were in your situation, if you're loading fonts from files, I'd try 
> calling releaseGLObjects on the object cache 
> (osgDB::Registry::instance()->getObjectCache()->releaseGLObjects();) right 
> before the context is closed, and if you're letting OSG use its default font, 
> I'd do the default font instead 
> (osgText::Font::getDefaultFont()->releaseGLObjects();). If either of these 
> helps, then the problem is what I think it is. I've not looked at the Android 
> examples, so I don't know where you'd put the call, though.
>
>
> Cheers,
> Chris
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=76475#76475
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to