Pass only the X11 window to Ogre, otherwise it would treat it as parentWindowHandle instead of externalWindowHandle. parentWindowHandle does not seem to play nice with SDL and occasionally crashes with a GLXBadDrawable error on startup.

actorid
scrawl 12 years ago
parent 91f6d87126
commit 50a0d16f8f

@ -105,6 +105,12 @@ namespace SFO
case SDL_WINDOWEVENT_FOCUS_LOST: case SDL_WINDOWEVENT_FOCUS_LOST:
case SDL_WINDOWEVENT_CLOSE: case SDL_WINDOWEVENT_CLOSE:
break; break;
case SDL_WINDOWEVENT_SHOWN:
mOgreWindow->setVisible(true);
break;
case SDL_WINDOWEVENT_HIDDEN:
mOgreWindow->setVisible(false);
break;
} }
} }

@ -315,9 +315,7 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
break; break;
#else #else
case SDL_SYSWM_X11: case SDL_SYSWM_X11:
winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.display); winHandle = Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
winHandle += ":0:";
winHandle += Ogre::StringConverter::toString((unsigned long)wmInfo.info.x11.window);
break; break;
#endif #endif
default: default:
@ -325,6 +323,8 @@ void OgreRenderer::createWindow(const std::string &title, const WindowSettings&
break; break;
} }
/// \todo externalWindowHandle is deprecated according to the source code. Figure out a way to get parentWindowHandle
/// to work properly. On Linux/X11 it causes an occasional GLXBadDrawable error.
params.insert(std::make_pair("externalWindowHandle", winHandle)); params.insert(std::make_pair("externalWindowHandle", winHandle));
mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, &params); mWindow = mRoot->createRenderWindow(title, settings.window_x, settings.window_y, settings.fullscreen, &params);

Loading…
Cancel
Save