Skip to content

Commit

Permalink
Restore GLX context after OGRE plugin loading finishes.
Browse files Browse the repository at this point in the history
The probing process OGRE uses might change the current GLX context, e.g. when used with VirtualGL.

Signed-off-by: Martin Pecka <peckama2@fel.cvut.cz>
  • Loading branch information
peci1 committed Dec 21, 2022
1 parent 74d8c78 commit 2f18450
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ogre2/src/Ogre2RenderEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 2f18450

Please sign in to comment.