From 3866cf286f37447b773b238152945f5166202c8c Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Mon, 18 Apr 2011 22:46:28 +0000 Subject: [PATCH] - update for video fallback if current resolution fails --- source/shared_lib/sources/platform/sdl/gl_wrap.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/shared_lib/sources/platform/sdl/gl_wrap.cpp b/source/shared_lib/sources/platform/sdl/gl_wrap.cpp index 978a643d..930d9042 100644 --- a/source/shared_lib/sources/platform/sdl/gl_wrap.cpp +++ b/source/shared_lib/sources/platform/sdl/gl_wrap.cpp @@ -114,13 +114,15 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str()); - // try to revert to 800x600 - screen = SDL_SetVideoMode(800, 600, 16, flags); - if(screen == 0) { - // try to revert to 640x480 - screen = SDL_SetVideoMode(640, 480, 8, flags); + for(int i = 32; i >= 8; i-=8) { + // try to revert to 800x600 + screen = SDL_SetVideoMode(800, 600, i, flags); if(screen == 0) { - throw std::runtime_error(msg.str()); + // try to revert to 640x480 + screen = SDL_SetVideoMode(640, 480, i, flags); + if(screen == 0) { + throw std::runtime_error(msg.str()); + } } } //throw std::runtime_error(msg.str());