From 8529b2f925c2a0f0cfa3ffe9218519b55223107e Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Thu, 9 Jun 2016 21:07:58 +0200 Subject: BGE: alpha on frame buffer and precedence of MSAA over swap. A new option '-a' can be passed to the blenderplayer. It forces the framebuffer to have an alpha channel. This can be used in VideoTexture to return a image with alpha channel with ImageViewport (provided alpha is set to True on the ImageViewport object and that the background color alpha channel is 0, which is the default). Without the -a option, the frame buffer has no alpha channel and ImageViewport always returns an opaque image, no matter what. In Linux, the player window will be rendered transparently over the desktop. In Windows, the player window is still rendered opaque because transparency of the window is only possible using the 'compositing' functions of Windows. The code is there but not enabled (look for WIN32_COMPOSITING) because 1) it doesn't work so well 2) it requires a DLL that is only available on Vista and up. give precedence to AA over Swap copy: Certain GPU (intel) will not allow MSAA together with swap copy. Previously, swap copy had priority over MSAA: fewer AA samples would be chosen if it was the condition to get swap copy. This patch reverse the logic: swap copy will be abandonned if another swap method (undefined or exchange) will provide the number of AA samples requested. If no AA samples is requested, swap copy still has the priority of course. --- CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index b558fe14820..15ee8349f39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,6 +273,7 @@ endif() if(WITH_X11) option(WITH_X11_XINPUT "Enable X11 Xinput (tablet support and unicode input)" ON) option(WITH_X11_XF86VMODE "Enable X11 video mode switching" ON) + option(WITH_X11_ALPHA "Enable X11 transparent background" ON) endif() if(UNIX AND NOT APPLE) @@ -723,6 +724,7 @@ if(WITH_GHOST_SDL OR WITH_HEADLESS) set(WITH_X11 OFF) set(WITH_X11_XINPUT OFF) set(WITH_X11_XF86VMODE OFF) + set(WITH_X11_ALPHA OFF) set(WITH_GHOST_XDND OFF) set(WITH_INPUT_IME OFF) endif() @@ -862,6 +864,16 @@ if(WITH_X11) endif() endif() + if(WITH_X11_ALPHA) + find_library(X11_Xrender_LIB Xrender ${X11_LIB_SEARCH_PATH}) + mark_as_advanced(X11_Xrender_LIB) + if (X11_Xrender_LIB) + list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB}) + else() + set(WITH_X11_ALPHA OFF) + endif() + endif() + endif() @@ -3199,6 +3211,7 @@ if(FIRST_RUN) info_cfg_text("System Options:") info_cfg_option(WITH_INSTALL_PORTABLE) + info_cfg_option(WITH_X11_ALPHA) info_cfg_option(WITH_X11_XF86VMODE) info_cfg_option(WITH_X11_XINPUT) info_cfg_option(WITH_MEM_JEMALLOC) -- cgit v1.2.3