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 1/4] 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); From 5a4817c147dd38ddd01082fb5c9c63d1ce1756fa Mon Sep 17 00:00:00 2001 From: Xenkhan <36826384+Xenkhan@users.noreply.github.com> Date: Wed, 20 Jun 2018 13:33:59 -0500 Subject: [PATCH 2/4] Get rid of reinterpret_cast<> --- apps/openmw/engine.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index a9f239914..78aaab5ea 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -379,16 +379,30 @@ void OMW::Engine::createWindow(Settings::Manager& settings) } setWindowIcon(); - + osg::ref_ptr traits = new osg::GraphicsContext::Traits; + int redSize; + int greenSize; + int blueSize; + int depthSize; + int stencilSize; + int doubleBuffer; + + SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redSize); + SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenSize); + SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueSize); + SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depthSize); + SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencilSize); + SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &doubleBuffer); + 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->red = redSize; + traits->green = greenSize; + traits->blue = blueSize; + traits->depth = depthSize; + traits->stencil = stencilSize; + traits->doubleBuffer = doubleBuffer; traits->windowName = SDL_GetWindowTitle(mWindow); traits->windowDecoration = !(SDL_GetWindowFlags(mWindow)&SDL_WINDOW_BORDERLESS); traits->screenNum = SDL_GetWindowDisplayIndex(mWindow); From 405a0caf29cda87449b37675772f05166c969f37 Mon Sep 17 00:00:00 2001 From: Xenkhan <36826384+Xenkhan@users.noreply.github.com> Date: Wed, 20 Jun 2018 13:56:00 -0500 Subject: [PATCH 3/4] Remove unneeded whitespace --- apps/openmw/engine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 78aaab5ea..c06a3cbd7 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -379,7 +379,7 @@ void OMW::Engine::createWindow(Settings::Manager& settings) } setWindowIcon(); - + osg::ref_ptr traits = new osg::GraphicsContext::Traits; int redSize; int greenSize; From f0acc645442819e1cc51d84eada83e1a6d3e40b0 Mon Sep 17 00:00:00 2001 From: Xenkhan <36826384+Xenkhan@users.noreply.github.com> Date: Thu, 21 Jun 2018 15:04:04 -0500 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc150f344..630948a0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Bug #4457: Item without CanCarry flag prevents shield autoequipping in dark areas Bug #4458: AiWander console command handles idle chances incorrectly Bug #4459: NotCell dialogue condition doesn't support partial matches + Bug #4471: Retrieve SDL window settings instead of using magic numbers Feature #4256: Implement ToggleBorders (TB) console command Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results Feature #4222: 360° screenshots