From 1cdaf1e3293b6bf641a9b9117a8bcef9364b7d85 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 22 Feb 2013 07:37:17 +0000 Subject: [PATCH] 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. --- intern/ghost/intern/GHOST_WindowWin32.cpp | 4 ++++ intern/ghost/intern/GHOST_WindowX11.cpp | 1 + 2 files changed, 5 insertions(+) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index bf429527199..93f9ccbf1eb 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -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; diff --git a/intern/ghost/intern/GHOST_WindowX11.cpp b/intern/ghost/intern/GHOST_WindowX11.cpp index 50520b7eda5..8184475b610 100644 --- a/intern/ghost/intern/GHOST_WindowX11.cpp +++ b/intern/ghost/intern/GHOST_WindowX11.cpp @@ -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;