summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/windows/wgl.c25
-rw-r--r--src/mesa/drivers/windows/wmesa.c17
2 files changed, 36 insertions, 6 deletions
diff --git a/src/mesa/drivers/windows/wgl.c b/src/mesa/drivers/windows/wgl.c
index 0db57641fe..62a4c1704c 100644
--- a/src/mesa/drivers/windows/wgl.c
+++ b/src/mesa/drivers/windows/wgl.c
@@ -1,4 +1,4 @@
-/* $Id: wgl.c,v 1.9 2001/09/18 16:39:38 kschultz Exp $ */
+/* $Id: wgl.c,v 1.10 2002/04/23 18:23:33 kschultz Exp $ */
/*
* This library is free software; you can redistribute it and/or
@@ -100,6 +100,7 @@ int qt_ext = sizeof(ext) / sizeof(ext[0]);
struct __pixelformat__ pix[] =
{
+ /* Double Buffer, alpha */
{ { sizeof(PIXELFORMATDESCRIPTOR), 1,
PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT|PFD_DOUBLEBUFFER|PFD_SWAP_COPY,
PFD_TYPE_RGBA,
@@ -107,6 +108,7 @@ struct __pixelformat__ pix[] =
0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },
GL_TRUE
},
+ /* Single Buffer, alpha */
{ { sizeof(PIXELFORMATDESCRIPTOR), 1,
PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT,
PFD_TYPE_RGBA,
@@ -114,6 +116,22 @@ struct __pixelformat__ pix[] =
0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },
GL_FALSE
},
+ /* Double Buffer, no alpha */
+ { { sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT|PFD_DOUBLEBUFFER|PFD_SWAP_COPY,
+ PFD_TYPE_RGBA,
+ 24, 8, 0, 8, 8, 8, 16, 0, 0,
+ 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },
+ GL_TRUE
+ },
+ /* Single Buffer, no alpha */
+ { { sizeof(PIXELFORMATDESCRIPTOR), 1,
+ PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_GENERIC_FORMAT,
+ PFD_TYPE_RGBA,
+ 24, 8, 0, 8, 8, 8, 16, 0, 0,
+ 0, 0, 0, 0, 0, 16, 8, 0, 0, 0, 0, 0, 0 },
+ GL_FALSE
+ },
};
int qt_pix = sizeof(pix) / sizeof(pix[0]);
@@ -158,7 +176,8 @@ WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC hdc)
if ( wgl_ctx[i].ctx == NULL )
{
wgl_ctx[i].ctx = WMesaCreateContext( hWnd, NULL, GL_TRUE,
- pix[curPFD-1].doubleBuffered );
+ pix[curPFD-1].doubleBuffered,
+ pix[curPFD-1].pfd.cAlphaBits ? GL_TRUE : GL_FALSE);
if (wgl_ctx[i].ctx == NULL)
break;
wgl_ctx[i].hdc = hdc;
@@ -559,6 +578,8 @@ WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC hdc,
continue;
if(ppfd->iPixelType != pix[i].pfd.iPixelType)
delta++;
+ if(ppfd->cAlphaBits != pix[i].pfd.cAlphaBits)
+ delta++;
if(delta < bestdelta)
{
best = i + 1;
diff --git a/src/mesa/drivers/windows/wmesa.c b/src/mesa/drivers/windows/wmesa.c
index 4f057bfad7..73037b7d05 100644
--- a/src/mesa/drivers/windows/wmesa.c
+++ b/src/mesa/drivers/windows/wmesa.c
@@ -1,4 +1,4 @@
-/* $Id: wmesa.c,v 1.26 2002/03/16 00:53:15 brianp Exp $ */
+/* $Id: wmesa.c,v 1.27 2002/04/23 18:23:33 kschultz Exp $ */
/*
* Windows (Win32) device driver for Mesa 3.4
@@ -396,6 +396,13 @@ static clear(GLcontext* ctx, GLbitfield mask,
/* sanity check - can't have right(stereo) buffers */
assert((mask & (DD_FRONT_RIGHT_BIT | DD_BACK_RIGHT_BIT)) == 0);
+ /* clear alpha */
+ if ((mask & (DD_FRONT_LEFT_BIT | DD_BACK_RIGHT_BIT)) &&
+ ctx->DrawBuffer->UseSoftwareAlphaBuffers &&
+ ctx->Color.ColorMask[ACOMP]) {
+ _mesa_clear_alpha_buffers( ctx );
+ }
+
if (*colorMask == 0xffffffff && ctx->Color.IndexMask == 0xffffffff) {
if (mask & DD_BACK_LEFT_BIT) {
#if defined(USE_GDI_TO_CLEAR)
@@ -1240,7 +1247,8 @@ static void GetPalette(HPALETTE Pal,RGBQUAD *aRGB)
WMesaContext WMesaCreateContext( HWND hWnd, HPALETTE* Pal,
GLboolean rgb_flag,
- GLboolean db_flag )
+ GLboolean db_flag,
+ GLboolean alpha_flag )
{
RECT CR;
WMesaContext c;
@@ -1318,7 +1326,8 @@ WMesaContext WMesaCreateContext( HWND hWnd, HPALETTE* Pal,
c->gl_visual = _mesa_create_visual(rgb_flag,
db_flag, /* db_flag */
GL_FALSE, /* stereo */
- 8,8,8,8, /* r, g, b, a bits */
+ 8,8,8, /* r, g, b bits */
+ alpha_flag ? 8 : 0, /* alpha bits */
0, /* index bits */
16, /* depth_bits */
8, /* stencil_bits */
@@ -1355,7 +1364,7 @@ WMesaContext WMesaCreateContext( HWND hWnd, HPALETTE* Pal,
c->gl_visual->depthBits > 0,
c->gl_visual->stencilBits > 0,
c->gl_visual->accumRedBits > 0,
- GL_FALSE /* s/w alpha */ );
+ alpha_flag /* s/w alpha */ );
if (!c->gl_buffer) {
_mesa_destroy_visual( c->gl_visual );
_mesa_free_context_data( c->gl_ctx );