diff options
author | Karl Schultz <[email protected]> | 2002-04-23 18:23:32 +0000 |
---|---|---|
committer | Karl Schultz <[email protected]> | 2002-04-23 18:23:32 +0000 |
commit | e694a8765a2406838354e39d5c40dab5fbb744e9 (patch) | |
tree | 72bd71093ffb3255b9a2581056a324bbebca18aa /src/mesa/drivers/windows/wgl.c | |
parent | 62c36a2ff39d775c1f1bc377b9ddbc69e2340799 (diff) |
Fix up alpha buffer handling for Windows.
- add two new Pixel Format Descriptors that do not have alpha bits to
mirror the two that do.
- add logic to wglChoosePixelFormat to match PFD's with respect to alpha.
- Create/clear software alpha buffer as required.
Now a wgl or GLUT program can control the creation of a software alpha
buffer via the PFD or GLUT parms, respectively.
Diffstat (limited to 'src/mesa/drivers/windows/wgl.c')
-rw-r--r-- | src/mesa/drivers/windows/wgl.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/mesa/drivers/windows/wgl.c b/src/mesa/drivers/windows/wgl.c index 0db57641fe1..62a4c1704ce 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; |