diff options
author | /dev/humancontroller <devhc@example.com> | 2014-07-13 18:05:31 +0200 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-03-09 13:51:11 +0100 |
commit | 8391e8997fad1bdbd6b9d189c6afca22d3e4324c (patch) | |
tree | b1e2f117c23a5a7ef7eb97274dc96e1823a9c9ae /src/sdl | |
parent | 59875f1378dca6605cd0426eff89f850d8743c92 (diff) |
request a visual with at least 1 alpha bit: add r_alphabits, defaulting to 1
this is required for binary shaders
Diffstat (limited to 'src/sdl')
-rw-r--r-- | src/sdl/sdl_glimp.c | 8 |
1 files changed, 6 insertions, 2 deletions
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 ); |