Browse Source

Platform: ability to request sRGB-capable framebuffer in Sdl2Application.

pull/122/merge
Vladimír Vondruš 11 years ago
parent
commit
9696bebaeb
  1. 7
      src/Magnum/Platform/Sdl2Application.cpp
  2. 22
      src/Magnum/Platform/Sdl2Application.h

7
src/Magnum/Platform/Sdl2Application.cpp

@ -105,6 +105,11 @@ bool Sdl2Application::tryCreateContext(const Configuration& configuration) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, configuration.sampleCount() > 1 ? 1 : 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, configuration.sampleCount() > 1 ? 1 : 0);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration.sampleCount()); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configuration.sampleCount());
#ifndef CORRADE_TARGET_EMSCRIPTEN
/* sRGB */
SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, configuration.isSRGBCapable());
#endif
/* Flags: if not hidden, set as shown */ /* Flags: if not hidden, set as shown */
Uint32 windowFlags(configuration.windowFlags()); Uint32 windowFlags(configuration.windowFlags());
if(!(configuration.windowFlags() & Configuration::WindowFlag::Hidden)) if(!(configuration.windowFlags() & Configuration::WindowFlag::Hidden))
@ -413,7 +418,7 @@ Sdl2Application::Configuration::Configuration():
#endif #endif
_size(800, 600), _windowFlags{}, _sampleCount(0) _size(800, 600), _windowFlags{}, _sampleCount(0)
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
, _version(Version::None) , _version(Version::None), _sRGBCapable{false}
#endif #endif
{} {}

22
src/Magnum/Platform/Sdl2Application.h

@ -719,6 +719,27 @@ class Sdl2Application::Configuration {
return *this; return *this;
} }
#ifndef CORRADE_TARGET_EMSCRIPTEN
/**
* @brief sRGB-capable default framebuffer
*
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten".
*/
bool isSRGBCapable() const { return _sRGBCapable; }
/**
* @brief Set sRGB-capable default framebuffer
* @return Reference to self (for method chaining)
*
* Default is `false`. See also @ref Renderer::Feature::FramebufferSRGB.
* @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten".
*/
Configuration& setSRGBCapable(bool enabled) {
_sRGBCapable = enabled;
return *this;
}
#endif
private: private:
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
std::string _title; std::string _title;
@ -729,6 +750,7 @@ class Sdl2Application::Configuration {
#ifndef CORRADE_TARGET_EMSCRIPTEN #ifndef CORRADE_TARGET_EMSCRIPTEN
Version _version; Version _version;
Flags _flags; Flags _flags;
bool _sRGBCapable;
#endif #endif
}; };

Loading…
Cancel
Save