From 8391e8997fad1bdbd6b9d189c6afca22d3e4324c Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Sun, 13 Jul 2014 18:05:31 +0200 Subject: request a visual with at least 1 alpha bit: add r_alphabits, defaulting to 1 this is required for binary shaders --- src/sdl/sdl_glimp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/sdl') diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c index cc3e6378..a54a9b47 100644 --- a/src/sdl/sdl_glimp.c +++ b/src/sdl/sdl_glimp.c @@ -223,7 +223,7 @@ static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen, qboolean nobor { const char *glstring; int perChannelColorBits; - int colorBits, depthBits, stencilBits; + int colorBits, alphaBits, depthBits, stencilBits; int samples; int i = 0; SDL_Surface *icon = NULL; @@ -354,6 +354,8 @@ static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen, qboolean nobor if ((!colorBits) || (colorBits >= 32)) colorBits = 24; + alphaBits = r_alphabits->value; + if (!r_depthbits->value) depthBits = 24; else @@ -430,12 +432,14 @@ static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen, qboolean nobor perChannelColorBits = 0; /* Use minimum size for 16-bit color */ /* Need alpha or else SGIs choose 36+ bit RGB mode */ - SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 1); + if (alphaBits < 1) + alphaBits = 1; #endif SDL_GL_SetAttribute( SDL_GL_RED_SIZE, perChannelColorBits ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, perChannelColorBits ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, perChannelColorBits ); + SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, alphaBits ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, testDepthBits ); SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, testStencilBits ); -- cgit