From: havoc Date: Tue, 26 Feb 2008 12:28:33 +0000 (+0000) Subject: audited PixelFormat setup code and made it request appropriate bit X-Git-Tag: xonotic-v0.1.0preview~2385 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ee66bae6438ee948c6facb49534a4776f4034515;p=xonotic%2Fdarkplaces.git audited PixelFormat setup code and made it request appropriate bit depths git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8137 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/vid_agl.c b/vid_agl.c index 2cf7194b..a3a65f20 100644 --- a/vid_agl.c +++ b/vid_agl.c @@ -502,17 +502,17 @@ static void VID_ProcessPendingAsyncEvents (void) static void VID_BuildAGLAttrib(GLint *attrib, qboolean stencil, qboolean fullscreen, qboolean stereobuffer, int samples) { *attrib++ = AGL_RGBA; - *attrib++ = AGL_RED_SIZE;*attrib++ = 1; - *attrib++ = AGL_GREEN_SIZE;*attrib++ = 1; - *attrib++ = AGL_BLUE_SIZE;*attrib++ = 1; + *attrib++ = AGL_RED_SIZE;*attrib++ = stencil ? 8 : 5; + *attrib++ = AGL_GREEN_SIZE;*attrib++ = stencil ? 8 : 5; + *attrib++ = AGL_BLUE_SIZE;*attrib++ = stencil ? 8 : 5; *attrib++ = AGL_DOUBLEBUFFER; - *attrib++ = AGL_DEPTH_SIZE;*attrib++ = 1; + *attrib++ = AGL_DEPTH_SIZE;*attrib++ = stencil ? 24 : 16; // if stencil is enabled, ask for alpha too if (stencil) { *attrib++ = AGL_STENCIL_SIZE;*attrib++ = 8; - *attrib++ = AGL_ALPHA_SIZE;*attrib++ = 1; + *attrib++ = AGL_ALPHA_SIZE;*attrib++ = 8; } if (fullscreen) *attrib++ = AGL_FULLSCREEN; diff --git a/vid_glx.c b/vid_glx.c index d51318a6..426e4cfc 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -616,20 +616,20 @@ void VID_Init(void) void VID_BuildGLXAttrib(int *attrib, qboolean stencil, qboolean stereobuffer, int samples) { *attrib++ = GLX_RGBA; - *attrib++ = GLX_RED_SIZE;*attrib++ = 1; - *attrib++ = GLX_GREEN_SIZE;*attrib++ = 1; - *attrib++ = GLX_BLUE_SIZE;*attrib++ = 1; + *attrib++ = GLX_RED_SIZE;*attrib++ = stencil ? 8 : 5; + *attrib++ = GLX_GREEN_SIZE;*attrib++ = stencil ? 8 : 5; + *attrib++ = GLX_BLUE_SIZE;*attrib++ = stencil ? 8 : 5; *attrib++ = GLX_DOUBLEBUFFER; - *attrib++ = GLX_DEPTH_SIZE;*attrib++ = 1; + *attrib++ = GLX_DEPTH_SIZE;*attrib++ = stencil ? 24 : 16; // if stencil is enabled, ask for alpha too if (stencil) { *attrib++ = GLX_STENCIL_SIZE;*attrib++ = 8; - *attrib++ = GLX_ALPHA_SIZE;*attrib++ = 1; + *attrib++ = GLX_ALPHA_SIZE;*attrib++ = 8; } if (stereobuffer) *attrib++ = GLX_STEREO; - if (samples) + if (samples > 1) { *attrib++ = GLX_SAMPLE_BUFFERS_ARB; *attrib++ = 1; diff --git a/vid_sdl.c b/vid_sdl.c index 5dbd5cc6..872f8cff 100644 --- a/vid_sdl.c +++ b/vid_sdl.c @@ -694,9 +694,9 @@ int VID_InitMode(int fullscreen, int width, int height, int bpp, int refreshrate } 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_RED_SIZE, 5); + SDL_GL_SetAttribute (SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute (SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 16); } if (stereobuffer) diff --git a/vid_wgl.c b/vid_wgl.c index 36520ee2..b5ecef71 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -843,13 +843,21 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int refreshrat // if stencil is enabled, ask for alpha too if (bpp >= 32) { - pfd.cStencilBits = 8; + pfd.cRedBits = 8; + pfd.cGreenBits = 8; + pfd.cBlueBits = 8; pfd.cAlphaBits = 8; + pfd.cDepthBits = 24; + pfd.cStencilBits = 8; } else { - pfd.cStencilBits = 0; + pfd.cRedBits = 5; + pfd.cGreenBits = 5; + pfd.cBlueBits = 5; pfd.cAlphaBits = 0; + pfd.cDepthBits = 16; + pfd.cStencilBits = 0; } if (stereobuffer) @@ -873,7 +881,7 @@ int VID_InitMode (int fullscreen, int width, int height, int bpp, int refreshrat *a++ = WGL_BLUE_BITS_ARB; *a++ = 8; *a++ = WGL_ALPHA_BITS_ARB; - *a++ = 1; + *a++ = 8; *a++ = WGL_DEPTH_BITS_ARB; *a++ = 24; *a++ = WGL_STENCIL_BITS_ARB;