diff --git a/ogre2/src/Ogre2RenderEngine.cc b/ogre2/src/Ogre2RenderEngine.cc index f91422f27..9a20332e7 100644 --- a/ogre2/src/Ogre2RenderEngine.cc +++ b/ogre2/src/Ogre2RenderEngine.cc @@ -539,8 +539,20 @@ void Ogre2RenderEngine::LoadPlugins() // load the plugin try { +#if HAVE_GLX + // Store the current GLX context in case OGRE plugin init changes it + const auto context = glXGetCurrentContext(); + const auto display = glXGetCurrentDisplay(); + const auto drawable = glXGetCurrentDrawable(); +#endif + // Load the plugin into OGRE this->ogreRoot->loadPlugin(filename); + +#if HAVE_GLX + // Restore GLX context + glXMakeCurrent(display, drawable, context); +#endif } catch(Ogre::Exception &e) {