bge bugfix: [#18967] alpha value is never available in the color buffer by Campbell Barton (X11) and me (Win32)

This is and old patch (June, 2009). The reason it never made into trunk it's that we (me at least) thought that
it should be optional, as a ui or command-line option.

However, it seems that OSX always have the OpenGL context with alpha enabled. So I think it's consistent to
have the other OSs to follow.

The main usage of this is the BGE (or more specifically people using BGE for TV broadcasting) but I think
pydevs can have their share of fun with it in Blender as well.
This commit is contained in:
Dalai Felinto 2013-02-22 07:37:17 +00:00
parent 4aea4c2cb3
commit 1cdaf1e329
2 changed files with 5 additions and 0 deletions

@ -712,6 +712,7 @@ GHOST_TSuccess GHOST_WindowWin32::initMultisample(PIXELFORMATDESCRIPTOR pfd)
WGL_ACCELERATION_ARB, WGL_FULL_ACCELERATION_ARB,
WGL_COLOR_BITS_ARB, pfd.cColorBits,
WGL_DEPTH_BITS_ARB, pfd.cDepthBits,
WGL_ALPHA_BITS_ART, pfd.cAlphaBits,
WGL_STENCIL_BITS_ARB, pfd.cStencilBits,
WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
WGL_SAMPLE_BUFFERS_ARB, GL_TRUE,
@ -1321,6 +1322,9 @@ static int WeightPixelFormat(PIXELFORMATDESCRIPTOR& pfd)
weight += pfd.cColorBits - 8;
if (pdf.cAlphaBits > 0)
weight ++;
/* want swap copy capability -- it matters a lot */
if (pfd.dwFlags & PFD_SWAP_COPY) weight += 16;

@ -213,6 +213,7 @@ GHOST_WindowX11(
attributes[i++] = GLX_BLUE_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_GREEN_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_DEPTH_SIZE; attributes[i++] = 1;
attributes[i++] = GLX_ALPHA_SIZE; attributes[i++] = 1;
/* GLX >= 1.4 required for multi-sample */
if (samples && (glxVersionMajor >= 1) && (glxVersionMinor >= 4)) {
attributes[i++] = GLX_SAMPLE_BUFFERS; attributes[i++] = 1;