add support for 32bit color in SDL builds
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 18 Oct 2004 10:16:26 +0000 (10:16 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 18 Oct 2004 10:16:26 +0000 (10:16 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4664 d7cf8633-e32d-0410-b094-e92efae38249

vid_sdl.c

index 5dfb624..b366fd9 100644 (file)
--- a/vid_sdl.c
+++ b/vid_sdl.c
@@ -415,11 +415,23 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp)
                vid_isfullscreen = true;
        }
 
-       SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 1);
-       SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1);
-       SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
-       SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
        SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
+       if (bpp >= 32)
+       {
+               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_ALPHA_SIZE, 8);
+               SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 24);
+               SDL_GL_SetAttribute (SDL_GL_STENCIL_SIZE, 8);
+       }
+       else
+       {
+               SDL_GL_SetAttribute (SDL_GL_RED_SIZE, 1);
+               SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 1);
+               SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 1);
+               SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16);
+       }
 
        screen = SDL_SetVideoMode(width, height, bpp, flags);
        if (screen == NULL)