[Change] Use 24-bit depth buffer where possible.

This commit is contained in:
Allanis 2017-11-13 21:08:14 +00:00
parent 56f5411516
commit 74712a4e19

View File

@ -74,15 +74,20 @@ void L3D::Init(IniConfig& config) {
fprintf(stderr, "Fatal error: Invalid screen depth in config.ini.\n"); fprintf(stderr, "Fatal error: Invalid screen depth in config.ini.\n");
L3D::Quit(); 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); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
Uint32 flags = SDL_OPENGL; Uint32 flags = SDL_OPENGL;
if(config.Int("StartFullscreen")) flags |= SDL_FULLSCREEN; if(config.Int("StartFullscreen")) flags |= SDL_FULLSCREEN;
if((L3D::scrSurface = SDL_SetVideoMode(width, height, info->vfmt->BitsPerPixel, flags)) == 0) { if((L3D::scrSurface = SDL_SetVideoMode(width, height, info->vfmt->BitsPerPixel, flags)) == 0) {
fprintf(stderr, "Video mode set failed: %s\n", SDL_GetError()); /* Fall back to 16-bit depth buffer.. */
exit(-1); 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; L3D::scrWidth = width;