From 0f049f72c6ea556f765fd9728b0e314e7fde395a Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Tue, 11 Aug 2020 18:46:33 -0400 Subject: [PATCH] Fix another bizarre SDL behavior with setting backing surface color... --- indra/llwindow/llwindowsdl.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index fcb28d0174f..4050e9c174a 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -424,6 +424,19 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // Setup default window flags mSDLFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; + // Setup default backing colors + GLint redBits{8}, greenBits{8}, blueBits{8}, alphaBits{8}; + + GLint depthBits{24}, stencilBits{8}; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, redBits); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, greenBits); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, blueBits); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits); + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits); + SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits); + if (mWindow == nullptr) { if (width == 0) @@ -560,18 +573,6 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B } } - GLint redBits{8}, greenBits{8}, blueBits{8}, alphaBits{(bits <= 16) ? 1 : 8}; - - GLint depthBits{(bits <= 16) ? 16 : 24}, stencilBits{8}; - - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, redBits); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, greenBits); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, blueBits); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits); - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits); - - SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); if (mFSAASamples > 0) -- GitLab