From e6dc5be1af95d6df7ec542624483304bfbef0d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Thu, 9 Apr 2020 16:37:52 +0200 Subject: [PATCH] Platform: default to 32-bit RGBA framebuffer instead of 24-bit RGB. macOS and Android is known to degrade 24-bit to 16-bit colors, this prevents them from doing that. --- doc/changelog.dox | 5 +++++ src/Magnum/Platform/AndroidApplication.cpp | 2 +- src/Magnum/Platform/AndroidApplication.h | 2 +- src/Magnum/Platform/EmscriptenApplication.cpp | 2 +- src/Magnum/Platform/EmscriptenApplication.h | 2 +- src/Magnum/Platform/GlfwApplication.cpp | 2 +- src/Magnum/Platform/GlfwApplication.h | 2 +- src/Magnum/Platform/Sdl2Application.cpp | 2 +- src/Magnum/Platform/Sdl2Application.h | 2 +- 9 files changed, 13 insertions(+), 8 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 6c5eb4ce8..eb8542643 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -374,6 +374,11 @@ See also: - Calling @ref Platform::Sdl2Application::exit() "Platform::*Application::exit()" directly in the application constructor will now make it exit right after constructor finished, without any event processing (see [mosra/magnum#429](https://github.com/mosra/magnum/issues/429)) +- @ref Platform::AndroidApplication, @ref Platform::EmscriptenApplication, + @ref Platform::GlfwApplication and @ref Platform::Sdl2Application now + default to 32-bit RGBA color buffer instead of 24-bit RGB, to avoid the + framebuffer degrading to 16-bit colors on some platforms (see + [mosra/magnum-integration#59](https://github.com/mosra/magnum-integration/issues/59)) @subsubsection changelog-latest-changes-trade Trade library diff --git a/src/Magnum/Platform/AndroidApplication.cpp b/src/Magnum/Platform/AndroidApplication.cpp index 35c38fcf7..e56c223aa 100644 --- a/src/Magnum/Platform/AndroidApplication.cpp +++ b/src/Magnum/Platform/AndroidApplication.cpp @@ -277,7 +277,7 @@ std::int32_t AndroidApplication::inputEvent(android_app* state, AInputEvent* eve } AndroidApplication::GLConfiguration::GLConfiguration(): - _colorBufferSize{8, 8, 8, 0}, _depthBufferSize{24}, _stencilBufferSize{0} {} + _colorBufferSize{8, 8, 8, 8}, _depthBufferSize{24}, _stencilBufferSize{0} {} void AndroidApplication::exec(android_app* state, Containers::Pointer(*instancer)(const Arguments&)) { state->onAppCmd = commandEvent; diff --git a/src/Magnum/Platform/AndroidApplication.h b/src/Magnum/Platform/AndroidApplication.h index 36298e1d3..604db77de 100644 --- a/src/Magnum/Platform/AndroidApplication.h +++ b/src/Magnum/Platform/AndroidApplication.h @@ -475,7 +475,7 @@ class AndroidApplication::GLConfiguration { /** * @brief Set color buffer size * - * Default is @cpp {8, 8, 8, 0} @ce (8-bit-per-channel RGB, no alpha). + * Default is @cpp {8, 8, 8, 8} @ce (8-bit-per-channel RGBA). * @see @ref setDepthBufferSize(), @ref setStencilBufferSize() */ GLConfiguration& setColorBufferSize(const Vector4i& size) { diff --git a/src/Magnum/Platform/EmscriptenApplication.cpp b/src/Magnum/Platform/EmscriptenApplication.cpp index a12a4d6fd..2f1c4c7c5 100644 --- a/src/Magnum/Platform/EmscriptenApplication.cpp +++ b/src/Magnum/Platform/EmscriptenApplication.cpp @@ -692,7 +692,7 @@ void EmscriptenApplication::textInputEvent(TextInputEvent&) {} #ifdef MAGNUM_TARGET_GL EmscriptenApplication::GLConfiguration::GLConfiguration(): - _colorBufferSize{8, 8, 8, 0}, _depthBufferSize{24}, _stencilBufferSize{0} {} + _colorBufferSize{8, 8, 8, 8}, _depthBufferSize{24}, _stencilBufferSize{0} {} #endif int EmscriptenApplication::exec() { diff --git a/src/Magnum/Platform/EmscriptenApplication.h b/src/Magnum/Platform/EmscriptenApplication.h index 55cab532e..4e858a726 100644 --- a/src/Magnum/Platform/EmscriptenApplication.h +++ b/src/Magnum/Platform/EmscriptenApplication.h @@ -1043,7 +1043,7 @@ class EmscriptenApplication::GLConfiguration { /** * @brief Set color buffer size * - * Default is @cpp {8, 8, 8, 0} @ce (8-bit-per-channel RGB, no alpha). + * Default is @cpp {8, 8, 8, 8} @ce (8-bit-per-channel RGBA). * @see @ref setDepthBufferSize(), @ref setStencilBufferSize() */ GLConfiguration& setColorBufferSize(const Vector4i& size) { diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index bcef5be59..a58e3fa95 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -875,7 +875,7 @@ void GlfwApplication::stopTextInput() { #ifdef MAGNUM_TARGET_GL GlfwApplication::GLConfiguration::GLConfiguration(): - _colorBufferSize{8, 8, 8, 0}, _depthBufferSize{24}, _stencilBufferSize{0}, + _colorBufferSize{8, 8, 8, 8}, _depthBufferSize{24}, _stencilBufferSize{0}, _sampleCount{0}, _version{GL::Version::None}, #ifndef MAGNUM_TARGET_GLES _flags{Flag::ForwardCompatible}, diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index 4e8395415..f1bedd58d 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -884,7 +884,7 @@ class GlfwApplication::GLConfiguration { /** * @brief Set color buffer size * - * Default is @cpp {8, 8, 8, 0} @ce (8-bit-per-channel RGB, no alpha). + * Default is @cpp {8, 8, 8, 8} @ce (8-bit-per-channel RGBA). * @see @ref setDepthBufferSize(), @ref setStencilBufferSize() */ GLConfiguration& setColorBufferSize(const Vector4i& size) { diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index cc86d43db..7867c49f3 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -1170,7 +1170,7 @@ void Sdl2Application::textEditingEvent(TextEditingEvent&) {} #ifdef MAGNUM_TARGET_GL Sdl2Application::GLConfiguration::GLConfiguration(): - _colorBufferSize{8, 8, 8, 0}, _depthBufferSize{24}, _stencilBufferSize{0}, + _colorBufferSize{8, 8, 8, 8}, _depthBufferSize{24}, _stencilBufferSize{0}, _sampleCount(0) #ifndef CORRADE_TARGET_EMSCRIPTEN , _version(GL::Version::None), diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index 108ab9874..115d7ce0d 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -1369,7 +1369,7 @@ class Sdl2Application::GLConfiguration { /** * @brief Set color buffer size * - * Default is @cpp {8, 8, 8, 0} @ce (8-bit-per-channel RGB, no alpha). + * Default is @cpp {8, 8, 8, 8} @ce (8-bit-per-channel RGBA). * @see @ref setDepthBufferSize(), @ref setStencilBufferSize() */ GLConfiguration& setColorBufferSize(const Vector4i& size) {