From c12ee99d119debe1a421a77c1cc6d99d958ae94b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 4 Nov 2005 16:41:06 +0000 Subject: MESA_GLX_ALPHA_BITS env var to force visual with alpha channel --- src/mesa/drivers/x11/fakeglx.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/mesa/drivers') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index cd26bade30b..1933fed0673 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -378,6 +378,18 @@ default_depth_bits(void) return zBits; } +static GLint +default_alpha_bits(void) +{ + int aBits; + const char *aEnv = _mesa_getenv("MESA_GLX_ALPHA_BITS"); + if (aEnv) + aBits = _mesa_atoi(aEnv); + else + aBits = 0; + return aBits; +} + static GLint default_accum_bits(void) { @@ -400,6 +412,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) int vislevel; GLint zBits = default_depth_bits(); GLint accBits = default_accum_bits(); + GLboolean alphaFlag = default_alpha_bits() > 0; vislevel = level_of_visual( dpy, visinfo ); if (vislevel) { @@ -437,7 +450,7 @@ create_glx_visual( Display *dpy, XVisualInfo *visinfo ) /* can be done? They should use glXChooseVisual(). */ return save_glx_visual( dpy, visinfo, GL_TRUE, /* rgb */ - GL_FALSE, /* alpha */ + alphaFlag, /* alpha */ GL_TRUE, /* double */ GL_FALSE, /* stereo */ zBits, @@ -1013,7 +1026,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) parselist++; { GLint size = *parselist++; - alpha_flag = size>0 ? 1 : 0; + alpha_flag = size ? GL_TRUE : GL_FALSE; } break; case GLX_DEPTH_SIZE: @@ -1223,6 +1236,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) depth_size = default_depth_bits(); } + if (!alpha_flag) { + alpha_flag = default_alpha_bits() > 0; + } + /* we only support one size of stencil and accum buffers. */ if (stencil_size > 0) stencil_size = STENCIL_BITS; -- cgit v1.2.3