mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
Add default font releaseGLObjects workaround for OSG <3.65
This resolves https://gitlab.com/OpenMW/openmw/issues/4704 I've not compiled this or anything and I'm going off my memory from around ten or eleven months ago, so if this fails CI or causes more problems, that's why. The most likely issue is that we'll need to make the context current before releasing the program.
This commit is contained in:
parent
2652b10b9c
commit
73722eedf3
1 changed files with 8 additions and 0 deletions
|
@ -100,6 +100,14 @@ RenderWidget::~RenderWidget()
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
CompositeViewer::get().removeView(mView);
|
CompositeViewer::get().removeView(mView);
|
||||||
|
|
||||||
|
#if OSG_VERSION_LESS_THAN(3,6,5)
|
||||||
|
// before OSG 3.6.4, the default font was a static object, and if it wasn't attached to the scene when a graphics context was destroyed, it's program wouldn't be released.
|
||||||
|
// 3.6.4 moved it into the object cache, which meant it usually got released, but not here.
|
||||||
|
// 3.6.5 improved cleanup with osgViewer::CompositeViewer::removeView so it more reliably released associated state for objects in the object cache.
|
||||||
|
osg::ref_ptr<osg::GraphicsContext> graphicsContext = mView->getCamera()->getGraphicsContext();
|
||||||
|
osgText::Font::getDefaultFont()->releaseGLObjects(graphicsContext->getState());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
catch(const std::exception& e)
|
catch(const std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue