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 | |
parent | 59875f1378dca6605cd0426eff89f850d8743c92 (diff) |
request a visual with at least 1 alpha bit: add r_alphabits, defaulting to 1
this is required for binary shaders
-rw-r--r-- | src/renderercommon/tr_common.h | 1 | ||||
-rw-r--r-- | src/renderergl1/tr_init.c | 2 | ||||
-rw-r--r-- | src/renderergl2/tr_init.c | 2 | ||||
-rw-r--r-- | src/sdl/sdl_glimp.c | 8 |
4 files changed, 11 insertions, 2 deletions
diff --git a/src/renderercommon/tr_common.h b/src/renderercommon/tr_common.h index 0dc5653d..005f75a4 100644 --- a/src/renderercommon/tr_common.h +++ b/src/renderercommon/tr_common.h @@ -81,6 +81,7 @@ extern glconfig_t glConfig; // outside of TR since it shouldn't be cleared duri extern cvar_t *r_stencilbits; // number of desired stencil bits extern cvar_t *r_depthbits; // number of desired depth bits extern cvar_t *r_colorbits; // number of desired color bits, only relevant for fullscreen +extern cvar_t *r_alphabits; // number of desired alpha bits extern cvar_t *r_texturebits; // number of desired texture bits extern cvar_t *r_ext_multisample; // 0 = use framebuffer depth diff --git a/src/renderergl1/tr_init.c b/src/renderergl1/tr_init.c index 0a9d75b9..3e815b6a 100644 --- a/src/renderergl1/tr_init.c +++ b/src/renderergl1/tr_init.c @@ -99,6 +99,7 @@ cvar_t *r_logFile; cvar_t *r_stencilbits; cvar_t *r_depthbits; cvar_t *r_colorbits; +cvar_t *r_alphabits; cvar_t *r_primitives; cvar_t *r_texturebits; cvar_t *r_ext_multisample; @@ -952,6 +953,7 @@ void R_Register( void ) r_detailTextures = ri.Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_colorbits = ri.Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH ); + r_alphabits = ri.Cvar_Get( "r_alphabits", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE | CVAR_LATCH ); r_depthbits = ri.Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_ext_multisample = ri.Cvar_Get( "r_ext_multisample", "0", CVAR_ARCHIVE | CVAR_LATCH ); diff --git a/src/renderergl2/tr_init.c b/src/renderergl2/tr_init.c index 4f0a53f4..1c7391e3 100644 --- a/src/renderergl2/tr_init.c +++ b/src/renderergl2/tr_init.c @@ -175,6 +175,7 @@ cvar_t *r_logFile; cvar_t *r_stencilbits; cvar_t *r_depthbits; cvar_t *r_colorbits; +cvar_t *r_alphabits; cvar_t *r_texturebits; cvar_t *r_ext_multisample; @@ -1111,6 +1112,7 @@ void R_Register( void ) r_detailTextures = ri.Cvar_Get( "r_detailtextures", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_texturebits = ri.Cvar_Get( "r_texturebits", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_colorbits = ri.Cvar_Get( "r_colorbits", "0", CVAR_ARCHIVE | CVAR_LATCH ); + r_alphabits = ri.Cvar_Get( "r_alphabits", "1", CVAR_ARCHIVE | CVAR_LATCH ); r_stencilbits = ri.Cvar_Get( "r_stencilbits", "8", CVAR_ARCHIVE | CVAR_LATCH ); r_depthbits = ri.Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE | CVAR_LATCH ); r_ext_multisample = ri.Cvar_Get( "r_ext_multisample", "0", CVAR_ARCHIVE | CVAR_LATCH ); 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 ); |