From 24ddb66af9493e1edde00684280bcbbf7089b992 Mon Sep 17 00:00:00 2001 From: Xenkhan <36826384+Xenkhan@users.noreply.github.com> Date: Tue, 19 Jun 2018 15:03:30 -0500 Subject: [PATCH] Retrieve SDL window settings instead of using magic numbers --- apps/openmw/engine.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 5052a13cc..a9f239914 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -383,18 +383,17 @@ void OMW::Engine::createWindow(Settings::Manager& settings) osg::ref_ptr traits = new osg::GraphicsContext::Traits; SDL_GetWindowPosition(mWindow, &traits->x, &traits->y); SDL_GetWindowSize(mWindow, &traits->width, &traits->height); + SDL_GL_GetAttribute(SDL_GL_RED_SIZE, reinterpret_cast(&traits->red)); + SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, reinterpret_cast(&traits->green)); + SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, reinterpret_cast(&traits->blue)); + SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, reinterpret_cast(&traits->depth)); + SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, reinterpret_cast(&traits->stencil)); + SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, reinterpret_cast(&traits->doubleBuffer)); traits->windowName = SDL_GetWindowTitle(mWindow); traits->windowDecoration = !(SDL_GetWindowFlags(mWindow)&SDL_WINDOW_BORDERLESS); traits->screenNum = SDL_GetWindowDisplayIndex(mWindow); - // FIXME: Some way to get these settings back from the SDL window? - traits->red = 8; - traits->green = 8; - traits->blue = 8; - traits->alpha = 0; // set to 0 to stop ScreenCaptureHandler reading the alpha channel - traits->depth = 24; - traits->stencil = 8; traits->vsync = vsync; - traits->doubleBuffer = true; + traits->alpha = 0; // set to 0 to stop ScreenCaptureHandler reading the alpha channel traits->inheritedWindowData = new SDLUtil::GraphicsWindowSDL2::WindowData(mWindow); osg::ref_ptr graphicsWindow = new SDLUtil::GraphicsWindowSDL2(traits);