Skip to content

Commit

Permalink
GRAPHICS: Fix usage of SDL_GL_DEPTH_SIZE
Browse files Browse the repository at this point in the history
A proper fix for 219b917
  • Loading branch information
clone2727 committed Jan 21, 2013
1 parent f295e61 commit 3a30896
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/graphics/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,8 @@ void GraphicsManager::initSize(int width, int height, bool fullscreen) {
// other one and 16bpp only as a last resort.
// If we're currently in 16bpp mode, we try the higher two first as well,
// before being okay with native 16bpp mode.
// However, for Windows, we prefer 24bpp over 32bpp since 32bpp in fullscreen
// forces OpenGL to start with a software renderer. Seriously.

#ifdef WIN32
const int colorModes[] = { 24, 32, 16 };
#else
const int colorModes[] = { bpp == 16 ? 32 : bpp, bpp == 24 ? 32 : 24, 16 };
#endif

bool foundMode = false;
for (int i = 0; i < ARRAYSIZE(colorModes); i++) {
Expand Down Expand Up @@ -282,7 +276,7 @@ int GraphicsManager::probeFSAA(int width, int height, int bpp, uint32 flags) {
SDL_GL_SetAttribute(SDL_GL_RED_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE , bpp);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
Expand All @@ -301,7 +295,7 @@ bool GraphicsManager::setupSDLGL(int width, int height, int bpp, uint32 flags) {
SDL_GL_SetAttribute(SDL_GL_RED_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE , bpp);
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE , 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
Expand Down

0 comments on commit 3a30896

Please sign in to comment.