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] 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);