diff --git a/src/main.cpp b/src/main.cpp index e80af8e..8d95fe9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -74,15 +74,20 @@ void L3D::Init(IniConfig& config) { fprintf(stderr, "Fatal error: Invalid screen depth in config.ini.\n"); L3D::Quit(); } - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); Uint32 flags = SDL_OPENGL; if(config.Int("StartFullscreen")) flags |= SDL_FULLSCREEN; if((L3D::scrSurface = SDL_SetVideoMode(width, height, info->vfmt->BitsPerPixel, flags)) == 0) { - fprintf(stderr, "Video mode set failed: %s\n", SDL_GetError()); - exit(-1); + /* Fall back to 16-bit depth buffer.. */ + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + fprintf(stderr,"Failed to set video mode. (%s). Re-trying with 16 bit depth buffer.\n",SDL_GetError()); + if((L3D::scrSurface = SDL_SetVideoMode(width, height, info->vfmt->BitsPerPixel, flags)) == 0) { + fprintf(stderr, "video mode set failed: %s\n", SDL_GetError()); + exit(-1); + } } L3D::scrWidth = width;