From 674a740da55faeffa86d3bc1eeff17df6bd0d5a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 16 Sep 2018 19:59:52 +0200 Subject: [PATCH] Renamed various sRGB-related GL APIs for consistency with naming in Math. As usual, the old names are deprecated aliases to the new things. --- doc/changelog.dox | 12 +++++- doc/opengl-mapping.dox | 2 +- src/Magnum/GL/AbstractTexture.cpp | 2 +- src/Magnum/GL/AbstractTexture.h | 2 +- src/Magnum/GL/CubeMapTexture.h | 19 ++++++--- src/Magnum/GL/CubeMapTextureArray.h | 17 ++++++-- src/Magnum/GL/RectangleTexture.h | 17 ++++++-- src/Magnum/GL/Renderer.h | 12 +++++- .../GL/Test/CubeMapTextureArrayGLTest.cpp | 8 ++-- src/Magnum/GL/Test/CubeMapTextureGLTest.cpp | 8 ++-- src/Magnum/GL/Test/RectangleTextureGLTest.cpp | 8 ++-- src/Magnum/GL/Test/TextureArrayGLTest.cpp | 16 +++---- src/Magnum/GL/Test/TextureGLTest.cpp | 24 +++++------ src/Magnum/GL/Texture.h | 15 +++++-- src/Magnum/GL/TextureArray.h | 19 ++++++--- src/Magnum/Platform/GlfwApplication.cpp | 2 +- src/Magnum/Platform/GlfwApplication.h | 32 ++++++++++---- src/Magnum/Platform/Sdl2Application.cpp | 6 +-- src/Magnum/Platform/Sdl2Application.h | 42 +++++++++++++------ 19 files changed, 178 insertions(+), 85 deletions(-) diff --git a/doc/changelog.dox b/doc/changelog.dox index 5f83ebd00..149953b3b 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -410,6 +410,16 @@ See also: - @ref Trade::CameraData constructor not taking an explicit type enum is deprecated, use @ref Trade::CameraData::CameraData(CameraType, Rad, Float, Float, Float, const void*) instead +- @cpp GL::*Texture::setSRGBDecode() @ce, + @cpp GL::Renderer::Feature::FramebufferSRGB @ce, + @cpp Platform::*Application::GLConfiguration::setSRGBCapable() @ce and + @cpp Platform::*Application::GLConfiguration::isSRGBCapable() @ce is + deprecated, use + @ref GL::Texture::setSrgbDecode() "GL::*Texture::setSrgbDecode()", + @ref GL::Renderer::Feature::FramebufferSrgb, + @ref Platform::Sdl2Application::GLConfiguration::setSrgbCapable() "Platform::*Application::GLConfiguration::setSrgbCapable()" and + @ref Platform::Sdl2Application::GLConfiguration::isSrgbCapable() "Platform::*Application::GLConfiguration::isSrgbCapable()" instead as it + has consistent naming with @ref Math::Color3 "Math::Color" APIs @subsection changelog-latest-compatibility Potential compatibility breakages, removed APIs @@ -1176,7 +1186,7 @@ a high-level overview. which allows the context to be destructed and created again in case the version is not what the application wants (as opposed to just aborting the application) (see [mosra/magnum#105](https://github.com/mosra/magnum/issues/105)) -- Added @ref Platform::Sdl2Application::GLConfiguration::setSRGBCapable() "Platform::Sdl2Application::Configuration::setSRGBCapable()" +- Added @cpp Platform::Sdl2Application::Configuration::setSRGBCapable() @ce - Added @ref Platform::Sdl2Application::Configuration::WindowFlag::Borderless and `Platform::Sdl2Application::Configuration::WindowFlag::AllowHighDpi` for iOS and macOS diff --git a/doc/opengl-mapping.dox b/doc/opengl-mapping.dox index a6fecfe2c..8a9369de4 100644 --- a/doc/opengl-mapping.dox +++ b/doc/opengl-mapping.dox @@ -378,7 +378,7 @@ OpenGL function | Matching API @fn_gl{TexImage1D}, \n @fn_gl{TexImage2D}, \n @fn_gl{TexImage3D} | @ref GL::Texture::setImage(), \n @ref GL::TextureArray::setImage(), \n @ref GL::CubeMapTexture::setImage(), \n @ref GL::CubeMapTextureArray::setImage(), \n @ref GL::RectangleTexture::setImage() @fn_gl{TexImage2DMultisample}, \n @fn_gl{TexImage3DMultisample} | @ref GL::MultisampleTexture::setStorage() @fn_gl_extension{TexPageCommitment,ARB,sparse_texture} | | -@fn_gl{TexParameter}, \n `glTextureParameter()`, \n @fn_gl_extension{TextureParameter,EXT,direct_state_access} | @ref GL::Texture::setBaseLevel() "*Texture::setBaseLevel()", \n @ref GL::Texture::setMaxLevel() "*Texture::setMaxLevel()", \n @ref GL::Texture::setMinificationFilter() "*Texture::setMinificationFilter()", \n @ref GL::Texture::setMagnificationFilter() "*Texture::setMagnificationFilter()", \n @ref GL::Texture::setMinLod() "*Texture::setMinLod()", \n @ref GL::Texture::setMaxLod() "*Texture::setMaxLod()", \n @ref GL::Texture::setLodBias() "*Texture::setLodBias()", \n @ref GL::Texture::setWrapping() "*Texture::setWrapping()", \n @ref GL::Texture::setBorderColor() "*Texture::setBorderColor()", \n @ref GL::Texture::setMaxAnisotropy() "*Texture::setMaxAnisotropy()", \n @ref GL::Texture::setSRGBDecode() "*Texture::setSRGBDecode()", \n @ref GL::Texture::setSwizzle() "*Texture::setSwizzle()", \n @ref GL::Texture::setCompareMode() "*Texture::setCompareMode()", \n @ref GL::Texture::setCompareFunction() "*Texture::setCompareFunction()", \n @ref GL::Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()" +@fn_gl{TexParameter}, \n `glTextureParameter()`, \n @fn_gl_extension{TextureParameter,EXT,direct_state_access} | @ref GL::Texture::setBaseLevel() "*Texture::setBaseLevel()", \n @ref GL::Texture::setMaxLevel() "*Texture::setMaxLevel()", \n @ref GL::Texture::setMinificationFilter() "*Texture::setMinificationFilter()", \n @ref GL::Texture::setMagnificationFilter() "*Texture::setMagnificationFilter()", \n @ref GL::Texture::setMinLod() "*Texture::setMinLod()", \n @ref GL::Texture::setMaxLod() "*Texture::setMaxLod()", \n @ref GL::Texture::setLodBias() "*Texture::setLodBias()", \n @ref GL::Texture::setWrapping() "*Texture::setWrapping()", \n @ref GL::Texture::setBorderColor() "*Texture::setBorderColor()", \n @ref GL::Texture::setMaxAnisotropy() "*Texture::setMaxAnisotropy()", \n @ref GL::Texture::setSrgbDecode() "*Texture::setSrgbDecode()", \n @ref GL::Texture::setSwizzle() "*Texture::setSwizzle()", \n @ref GL::Texture::setCompareMode() "*Texture::setCompareMode()", \n @ref GL::Texture::setCompareFunction() "*Texture::setCompareFunction()", \n @ref GL::Texture::setDepthStencilMode() "*Texture::setDepthStencilMode()" @fn_gl{TexStorage1D}, \n `glTextureStorage1D()`, \n @fn_gl_extension{TextureStorage1D,EXT,direct_state_access}, \n @fn_gl{TexStorage2D}, \n `glTextureStorage2D()`, \n @fn_gl_extension{TextureStorage2D,EXT,direct_state_access}, \n @fn_gl{TexStorage3D}, \n `glTextureStorage3D()`, \n @fn_gl_extension{TextureStorage3D,EXT,direct_state_access} | @ref GL::Texture::setStorage(), \n @ref GL::TextureArray::setStorage(), \n @ref GL::CubeMapTexture::setStorage(), \n @ref GL::CubeMapTextureArray::setStorage(), \n @ref GL::RectangleTexture::setStorage() @fn_gl{TexStorage2DMultisample}, \n `glTextureStorage2DMultisample()`, \n @fn_gl_extension{TextureStorage2DMultisample,EXT,direct_state_access}, \n @fn_gl{TexStorage3DMultisample}, \n `glTextureStorage3DMultisample()`, \n @fn_gl_extension{TextureStorage3DMultisample,EXT,direct_state_access} | @ref GL::MultisampleTexture::setStorage() @fn_gl{TexSubImage1D}, \n `glTextureSubImage1D()`, \n @fn_gl_extension{TextureSubImage1D,EXT,direct_state_access}, \n @fn_gl{TexSubImage2D}, \n `glTextureSubImage2D()`, \n @fn_gl_extension{TextureSubImage2D,EXT,direct_state_access}, \n @fn_gl{TexSubImage3D}, \n `glTextureSubImage3D()`, \n @fn_gl_extension{TextureSubImage3D,EXT,direct_state_access} | @ref GL::Texture::setSubImage(), \n @ref GL::TextureArray::setSubImage(), \n @ref GL::CubeMapTexture::setSubImage(), \n @ref GL::CubeMapTextureArray::setSubImage(), \n @ref GL::RectangleTexture::setSubImage() diff --git a/src/Magnum/GL/AbstractTexture.cpp b/src/Magnum/GL/AbstractTexture.cpp index 04da01351..b6850aaae 100644 --- a/src/Magnum/GL/AbstractTexture.cpp +++ b/src/Magnum/GL/AbstractTexture.cpp @@ -444,7 +444,7 @@ void AbstractTexture::setMaxAnisotropy(const Float anisotropy) { } #ifndef MAGNUM_TARGET_WEBGL -void AbstractTexture::setSRGBDecode(bool decode) { +void AbstractTexture::setSrgbDecode(bool decode) { (this->*Context::current().state().texture->parameteriImplementation)(GL_TEXTURE_SRGB_DECODE_EXT, decode ? GL_DECODE_EXT : GL_SKIP_DECODE_EXT); } diff --git a/src/Magnum/GL/AbstractTexture.h b/src/Magnum/GL/AbstractTexture.h index 83f0ba9e3..53598c494 100644 --- a/src/Magnum/GL/AbstractTexture.h +++ b/src/Magnum/GL/AbstractTexture.h @@ -474,7 +474,7 @@ class MAGNUM_GL_EXPORT AbstractTexture: public AbstractObject { #endif void setMaxAnisotropy(Float anisotropy); #ifndef MAGNUM_TARGET_WEBGL - void setSRGBDecode(bool decode); + void setSrgbDecode(bool decode); #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) diff --git a/src/Magnum/GL/CubeMapTexture.h b/src/Magnum/GL/CubeMapTexture.h index c793fe749..0e16dc067 100644 --- a/src/Magnum/GL/CubeMapTexture.h +++ b/src/Magnum/GL/CubeMapTexture.h @@ -426,21 +426,30 @@ class MAGNUM_GL_EXPORT CubeMapTexture: public AbstractTexture { #ifndef MAGNUM_TARGET_WEBGL /** - * @brief @copybrief Texture::setSRGBDecode() + * @brief @copybrief Texture::setSrgbDecode() * @return Reference to self (for method chaining) * - * See @ref Texture::setSRGBDecode() for more information. + * See @ref Texture::setSrgbDecode() for more information. * @requires_extension Extension @gl_extension{EXT,texture_sRGB_decode} * @requires_es_extension OpenGL ES 3.0 or extension * @gl_extension{EXT,sRGB} and * @gl_extension{ANDROID,extension_pack_es31a} / * @gl_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} - * @requires_gles SRGB decode is not available in WebGL. + * @requires_gles sRGB decode is not available in WebGL. */ - CubeMapTexture& setSRGBDecode(bool decode) { - AbstractTexture::setSRGBDecode(decode); + CubeMapTexture& setSrgbDecode(bool decode) { + AbstractTexture::setSrgbDecode(decode); return *this; } + + #ifdef MAGNUM_BUILD_DEPRECATED + /** @brief @copybrief setSrgbDecode() + * @deprecated Use @ref setSrgbDecode() instead. + */ + CORRADE_DEPRECATED("use setSrgbDecode() instead") CubeMapTexture& setSRGBDecode(bool decode) { + return setSrgbDecode(decode); + } + #endif #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) diff --git a/src/Magnum/GL/CubeMapTextureArray.h b/src/Magnum/GL/CubeMapTextureArray.h index 8e753cfa9..3fd232343 100644 --- a/src/Magnum/GL/CubeMapTextureArray.h +++ b/src/Magnum/GL/CubeMapTextureArray.h @@ -373,19 +373,28 @@ class MAGNUM_GL_EXPORT CubeMapTextureArray: public AbstractTexture { } /** - * @brief @copybrief Texture::setSRGBDecode() + * @brief @copybrief Texture::setSrgbDecode() * @return Reference to self (for method chaining) * - * See @ref Texture::setSRGBDecode() for more information. + * See @ref Texture::setSrgbDecode() for more information. * @requires_extension Extension @gl_extension{EXT,texture_sRGB_decode} * @requires_es_extension Extension @gl_extension{ANDROID,extension_pack_es31a} / * @gl_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} */ - CubeMapTextureArray& setSRGBDecode(bool decode) { - AbstractTexture::setSRGBDecode(decode); + CubeMapTextureArray& setSrgbDecode(bool decode) { + AbstractTexture::setSrgbDecode(decode); return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED + /** @brief @copybrief setSrgbDecode() + * @deprecated Use @ref setSrgbDecode() instead. + */ + CORRADE_DEPRECATED("use setSrgbDecode() instead") CubeMapTextureArray& setSRGBDecode(bool decode) { + return setSrgbDecode(decode); + } + #endif + /** * @brief @copybrief Texture::setSwizzle() * @return Reference to self (for method chaining) diff --git a/src/Magnum/GL/RectangleTexture.h b/src/Magnum/GL/RectangleTexture.h index c44c63ba7..3cf4a9b77 100644 --- a/src/Magnum/GL/RectangleTexture.h +++ b/src/Magnum/GL/RectangleTexture.h @@ -267,17 +267,26 @@ class MAGNUM_GL_EXPORT RectangleTexture: public AbstractTexture { } /** - * @brief @copybrief Texture::setSRGBDecode() + * @brief @copybrief Texture::setSrgbDecode() * @return Reference to self (for method chaining) * - * See @ref Texture::setSRGBDecode() for more information. + * See @ref Texture::setSrgbDecode() for more information. * @requires_extension Extension @gl_extension{EXT,texture_sRGB_decode} */ - RectangleTexture& setSRGBDecode(bool decode) { - AbstractTexture::setSRGBDecode(decode); + RectangleTexture& setSrgbDecode(bool decode) { + AbstractTexture::setSrgbDecode(decode); return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED + /** @brief @copybrief setSrgbDecode() + * @deprecated Use @ref setSrgbDecode() instead. + */ + CORRADE_DEPRECATED("use setSrgbDecode() instead") RectangleTexture& setSRGBDecode(bool decode) { + return setSrgbDecode(decode); + } + #endif + /** * @brief @copybrief Texture::setSwizzle() * @return Reference to self (for method chaining) diff --git a/src/Magnum/GL/Renderer.h b/src/Magnum/GL/Renderer.h index 5310bb799..ec1cbedb8 100644 --- a/src/Magnum/GL/Renderer.h +++ b/src/Magnum/GL/Renderer.h @@ -171,9 +171,17 @@ class MAGNUM_GL_EXPORT Renderer { * off. */ #ifndef MAGNUM_TARGET_GLES - FramebufferSRGB = GL_FRAMEBUFFER_SRGB, + FramebufferSrgb = GL_FRAMEBUFFER_SRGB, #else - FramebufferSRGB = GL_FRAMEBUFFER_SRGB_EXT, + FramebufferSrgb = GL_FRAMEBUFFER_SRGB_EXT, + #endif + + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * Perform sRGB conversion of values written to sRGB framebuffers. + * @deprecated Use @ref Feature::FramebufferSrgb instead. + */ + FramebufferSRGB CORRADE_DEPRECATED_ENUM("use GL::Renderer::Feature::FramebufferSrgb instead") = FramebufferSrgb, #endif #endif diff --git a/src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp b/src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp index 343f75900..e237cf698 100644 --- a/src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp +++ b/src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp @@ -49,7 +49,7 @@ struct CubeMapTextureArrayGLTest: OpenGLTester { void bindImage(); template void sampling(); - void samplingSRGBDecode(); + void samplingSrgbDecode(); void samplingBorderInteger(); void samplingSwizzle(); void samplingDepthStencilMode(); @@ -283,7 +283,7 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() { &CubeMapTextureArrayGLTest::sampling, &CubeMapTextureArrayGLTest::sampling, - &CubeMapTextureArrayGLTest::samplingSRGBDecode, + &CubeMapTextureArrayGLTest::samplingSrgbDecode, &CubeMapTextureArrayGLTest::samplingBorderInteger, &CubeMapTextureArrayGLTest::samplingSwizzle, &CubeMapTextureArrayGLTest::samplingDepthStencilMode, @@ -462,7 +462,7 @@ template void CubeMapTextureArrayGLTest::sampling() { MAGNUM_VERIFY_NO_GL_ERROR(); } -void CubeMapTextureArrayGLTest::samplingSRGBDecode() { +void CubeMapTextureArrayGLTest::samplingSrgbDecode() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_cube_map_array::string() + std::string(" is not supported.")); @@ -474,7 +474,7 @@ void CubeMapTextureArrayGLTest::samplingSRGBDecode() { CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); CubeMapTextureArray texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } diff --git a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp index 8865af034..6662a7d59 100644 --- a/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp +++ b/src/Magnum/GL/Test/CubeMapTextureGLTest.cpp @@ -56,7 +56,7 @@ struct CubeMapTextureGLTest: OpenGLTester { template void sampling(); #ifndef MAGNUM_TARGET_WEBGL - void samplingSRGBDecode(); + void samplingSrgbDecode(); #endif #ifndef MAGNUM_TARGET_GLES2 void samplingSwizzle(); @@ -311,7 +311,7 @@ CubeMapTextureGLTest::CubeMapTextureGLTest() { &CubeMapTextureGLTest::sampling, &CubeMapTextureGLTest::sampling, #ifndef MAGNUM_TARGET_WEBGL - &CubeMapTextureGLTest::samplingSRGBDecode, + &CubeMapTextureGLTest::samplingSrgbDecode, #endif #ifndef MAGNUM_TARGET_GLES2 &CubeMapTextureGLTest::samplingSwizzle, @@ -498,7 +498,7 @@ template void CubeMapTextureGLTest::sampling() { } #ifndef MAGNUM_TARGET_WEBGL -void CubeMapTextureGLTest::samplingSRGBDecode() { +void CubeMapTextureGLTest::samplingSrgbDecode() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::sRGB::string() + std::string(" is not supported.")); @@ -507,7 +507,7 @@ void CubeMapTextureGLTest::samplingSRGBDecode() { CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); CubeMapTexture texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } diff --git a/src/Magnum/GL/Test/RectangleTextureGLTest.cpp b/src/Magnum/GL/Test/RectangleTextureGLTest.cpp index e94163654..870cbd3b6 100644 --- a/src/Magnum/GL/Test/RectangleTextureGLTest.cpp +++ b/src/Magnum/GL/Test/RectangleTextureGLTest.cpp @@ -50,7 +50,7 @@ struct RectangleTextureGLTest: OpenGLTester { void bindImage(); template void sampling(); - void samplingSRGBDecode(); + void samplingSrgbDecode(); void samplingBorderInteger(); void samplingSwizzle(); void samplingDepthStencilMode(); @@ -118,7 +118,7 @@ RectangleTextureGLTest::RectangleTextureGLTest() { &RectangleTextureGLTest::sampling, &RectangleTextureGLTest::sampling, - &RectangleTextureGLTest::samplingSRGBDecode, + &RectangleTextureGLTest::samplingSrgbDecode, &RectangleTextureGLTest::samplingBorderInteger, &RectangleTextureGLTest::samplingSwizzle, &RectangleTextureGLTest::samplingDepthStencilMode, @@ -243,14 +243,14 @@ template void RectangleTextureGLTest::sampling() { MAGNUM_VERIFY_NO_GL_ERROR(); } -void RectangleTextureGLTest::samplingSRGBDecode() { +void RectangleTextureGLTest::samplingSrgbDecode() { if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported.")); if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); RectangleTexture texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } diff --git a/src/Magnum/GL/Test/TextureArrayGLTest.cpp b/src/Magnum/GL/Test/TextureArrayGLTest.cpp index 01800dffe..59ad5ed50 100644 --- a/src/Magnum/GL/Test/TextureArrayGLTest.cpp +++ b/src/Magnum/GL/Test/TextureArrayGLTest.cpp @@ -70,9 +70,9 @@ struct TextureArrayGLTest: OpenGLTester { template void sampling2D(); #ifndef MAGNUM_TARGET_GLES - void samplingSRGBDecode1D(); + void samplingSrgbDecode1D(); #endif - void samplingSRGBDecode2D(); + void samplingSrgbDecode2D(); #ifndef MAGNUM_TARGET_GLES void samplingSwizzle1D(); @@ -287,9 +287,9 @@ TextureArrayGLTest::TextureArrayGLTest() { &TextureArrayGLTest::sampling2D, #ifndef MAGNUM_TARGET_GLES - &TextureArrayGLTest::samplingSRGBDecode1D, + &TextureArrayGLTest::samplingSrgbDecode1D, #endif - &TextureArrayGLTest::samplingSRGBDecode2D, + &TextureArrayGLTest::samplingSrgbDecode2D, #ifndef MAGNUM_TARGET_GLES &TextureArrayGLTest::samplingSwizzle1D, @@ -578,14 +578,14 @@ template void TextureArrayGLTest::sampling1D() { MAGNUM_VERIFY_NO_GL_ERROR(); } -void TextureArrayGLTest::samplingSRGBDecode1D() { +void TextureArrayGLTest::samplingSrgbDecode1D() { if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::texture_array::string() + std::string(" is not supported.")); if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); Texture1DArray texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } @@ -668,7 +668,7 @@ template void TextureArrayGLTest::sampling2D() { MAGNUM_VERIFY_NO_GL_ERROR(); } -void TextureArrayGLTest::samplingSRGBDecode2D() { +void TextureArrayGLTest::samplingSrgbDecode2D() { #ifndef MAGNUM_TARGET_GLES if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::texture_array::string() + std::string(" is not supported.")); @@ -677,7 +677,7 @@ void TextureArrayGLTest::samplingSRGBDecode2D() { CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); Texture2DArray texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } diff --git a/src/Magnum/GL/Test/TextureGLTest.cpp b/src/Magnum/GL/Test/TextureGLTest.cpp index 388885bc3..c927cea80 100644 --- a/src/Magnum/GL/Test/TextureGLTest.cpp +++ b/src/Magnum/GL/Test/TextureGLTest.cpp @@ -88,10 +88,10 @@ struct TextureGLTest: OpenGLTester { #ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_GLES - void samplingSRGBDecode1D(); + void samplingSrgbDecode1D(); #endif - void samplingSRGBDecode2D(); - void samplingSRGBDecode3D(); + void samplingSrgbDecode2D(); + void samplingSrgbDecode3D(); #endif #ifndef MAGNUM_TARGET_GLES2 @@ -475,10 +475,10 @@ TextureGLTest::TextureGLTest() { #ifndef MAGNUM_TARGET_WEBGL #ifndef MAGNUM_TARGET_GLES - &TextureGLTest::samplingSRGBDecode1D, + &TextureGLTest::samplingSrgbDecode1D, #endif - &TextureGLTest::samplingSRGBDecode2D, - &TextureGLTest::samplingSRGBDecode3D, + &TextureGLTest::samplingSrgbDecode2D, + &TextureGLTest::samplingSrgbDecode3D, #endif #ifndef MAGNUM_TARGET_GLES2 @@ -904,12 +904,12 @@ template void TextureGLTest::sampling1D() { MAGNUM_VERIFY_NO_GL_ERROR(); } -void TextureGLTest::samplingSRGBDecode1D() { +void TextureGLTest::samplingSrgbDecode1D() { if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); Texture1D texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } @@ -982,7 +982,7 @@ template void TextureGLTest::sampling2D() { } #ifndef MAGNUM_TARGET_WEBGL -void TextureGLTest::samplingSRGBDecode2D() { +void TextureGLTest::samplingSrgbDecode2D() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::EXT::sRGB::string() + std::string(" is not supported.")); @@ -991,7 +991,7 @@ void TextureGLTest::samplingSRGBDecode2D() { CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); Texture2D texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } @@ -1117,7 +1117,7 @@ template void TextureGLTest::sampling3D() { MAGNUM_VERIFY_NO_GL_ERROR(); } -void TextureGLTest::samplingSRGBDecode3D() { +void TextureGLTest::samplingSrgbDecode3D() { #ifdef MAGNUM_TARGET_GLES2 if(!Context::current().isExtensionSupported()) CORRADE_SKIP(Extensions::OES::texture_3D::string() + std::string(" is not supported.")); @@ -1128,7 +1128,7 @@ void TextureGLTest::samplingSRGBDecode3D() { CORRADE_SKIP(Extensions::EXT::texture_sRGB_decode::string() + std::string(" is not supported.")); Texture3D texture; - texture.setSRGBDecode(false); + texture.setSrgbDecode(false); MAGNUM_VERIFY_NO_GL_ERROR(); } diff --git a/src/Magnum/GL/Texture.h b/src/Magnum/GL/Texture.h index ee6371189..680b8a59a 100644 --- a/src/Magnum/GL/Texture.h +++ b/src/Magnum/GL/Texture.h @@ -596,12 +596,21 @@ template class Texture: public AbstractTexture { * @gl_extension{EXT,sRGB} and * @gl_extension{ANDROID,extension_pack_es31a} / * @gl_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} - * @requires_gles SRGB decode is not available in WebGL. + * @requires_gles sRGB decode is not available in WebGL. */ - Texture& setSRGBDecode(bool decode) { - AbstractTexture::setSRGBDecode(decode); + Texture& setSrgbDecode(bool decode) { + AbstractTexture::setSrgbDecode(decode); return *this; } + + #ifdef MAGNUM_BUILD_DEPRECATED + /** @brief @copybrief setSrgbDecode() + * @deprecated Use @ref setSrgbDecode() instead. + */ + CORRADE_DEPRECATED("use setSrgbDecode() instead") Texture& setSRGBDecode(bool decode) { + return setSrgbDecode(decode); + } + #endif #endif #if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL) diff --git a/src/Magnum/GL/TextureArray.h b/src/Magnum/GL/TextureArray.h index 174e6e197..f2b26e15a 100644 --- a/src/Magnum/GL/TextureArray.h +++ b/src/Magnum/GL/TextureArray.h @@ -399,20 +399,29 @@ template class TextureArray: public AbstractTexture { #ifndef MAGNUM_TARGET_WEBGL /** - * @brief @copybrief Texture::setSRGBDecode() + * @brief @copybrief Texture::setSrgbDecode() * @return Reference to self (for method chaining) * - * See @ref Texture::setSRGBDecode() for more information. + * See @ref Texture::setSrgbDecode() for more information. * @requires_extension Extension @gl_extension{EXT,texture_sRGB_decode} * @requires_es_extension Extension @gl_extension{ANDROID,extension_pack_es31a} / * @gl_extension2{EXT,texture_sRGB_decode,texture_sRGB_decode} - * @requires_gles SRGB decode is not available in WebGL. + * @requires_gles sRGB decode is not available in WebGL. */ - TextureArray& setSRGBDecode(bool decode) { - AbstractTexture::setSRGBDecode(decode); + TextureArray& setSrgbDecode(bool decode) { + AbstractTexture::setSrgbDecode(decode); return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED + /** @brief @copybrief setSrgbDecode() + * @deprecated Use @ref setSrgbDecode() instead. + */ + CORRADE_DEPRECATED("use setSrgbDecode() instead") TextureArray& setSRGBDecode(bool decode) { + return setSrgbDecode(decode); + } + #endif + /** * @brief @copybrief Texture::setSwizzle() * @return Reference to self (for method chaining) diff --git a/src/Magnum/Platform/GlfwApplication.cpp b/src/Magnum/Platform/GlfwApplication.cpp index 8659eb662..ab70fb3b1 100644 --- a/src/Magnum/Platform/GlfwApplication.cpp +++ b/src/Magnum/Platform/GlfwApplication.cpp @@ -322,7 +322,7 @@ bool GlfwApplication::tryCreate(const Configuration& configuration, const GLConf glfwWindowHint(GLFW_DEPTH_BITS, glConfiguration.depthBufferSize()); glfwWindowHint(GLFW_STENCIL_BITS, glConfiguration.stencilBufferSize()); glfwWindowHint(GLFW_SAMPLES, glConfiguration.sampleCount()); - glfwWindowHint(GLFW_SRGB_CAPABLE, glConfiguration.isSRGBCapable()); + glfwWindowHint(GLFW_SRGB_CAPABLE, glConfiguration.isSrgbCapable()); const GLConfiguration::Flags& flags = glConfiguration.flags(); #ifdef GLFW_CONTEXT_NO_ERROR diff --git a/src/Magnum/Platform/GlfwApplication.h b/src/Magnum/Platform/GlfwApplication.h index 52cbfb399..1f3a230a0 100644 --- a/src/Magnum/Platform/GlfwApplication.h +++ b/src/Magnum/Platform/GlfwApplication.h @@ -701,19 +701,33 @@ class GlfwApplication::GLConfiguration { } /** @brief sRGB-capable default framebuffer */ - bool isSRGBCapable() const { - return _srgbCapable; - } + bool isSrgbCapable() const { return _srgbCapable; } /** * @brief Set sRGB-capable default framebuffer * @return Reference to self (for method chaining) */ - GLConfiguration& setSRGBCapable(bool enabled) { + GLConfiguration& setSrgbCapable(bool enabled) { _srgbCapable = enabled; return *this; } + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @brief @copybrief isSrgbCapable() + * @deprecated Use @ref isSrgbCapable() instead. + */ + CORRADE_DEPRECATED("use isSrgbCapable() instead") bool isSRGBCapable() const { return isSrgbCapable(); } + + /** + * @brief @copybrief setSrgbCapable() + * @deprecated Use @ref setSrgbCapable() instead. + */ + CORRADE_DEPRECATED("use setSrgbCapable() instead") GLConfiguration& setSRGBCapable(bool enabled) { + return setSrgbCapable(enabled); + } + #endif + private: Vector4i _colorBufferSize; Int _depthBufferSize, _stencilBufferSize; @@ -1041,17 +1055,17 @@ class GlfwApplication::Configuration { return *this; } - /** @brief @copybrief GLConfiguration::isSRGBCapable() - * @deprecated Use @ref GLConfiguration::isSRGBCapable() instead. + /** @brief @copybrief GLConfiguration::isSrgbCapable() + * @deprecated Use @ref GLConfiguration::isSrgbCapable() instead. */ CORRADE_DEPRECATED("use GLConfiguration::isSRGBCapable() instead") bool isSRGBCapable() const { return _srgbCapable; } - /** @brief @copybrief GLConfiguration::setSRGBCapable() - * @deprecated Use @ref GLConfiguration::setSRGBCapable() instead. + /** @brief @copybrief GLConfiguration::setSrgbCapable() + * @deprecated Use @ref GLConfiguration::setSrgbCapable() instead. */ - CORRADE_DEPRECATED("use GLConfiguration::setSRGBCapable() instead") Configuration& setSRGBCapable(bool enabled) { + CORRADE_DEPRECATED("use GLConfiguration::setSrgbCapable() instead") Configuration& setSRGBCapable(bool enabled) { _srgbCapable = enabled; return *this; } diff --git a/src/Magnum/Platform/Sdl2Application.cpp b/src/Magnum/Platform/Sdl2Application.cpp index eadc0951d..6169535af 100644 --- a/src/Magnum/Platform/Sdl2Application.cpp +++ b/src/Magnum/Platform/Sdl2Application.cpp @@ -300,7 +300,7 @@ bool Sdl2Application::tryCreate(const Configuration& configuration, const GLConf #ifndef CORRADE_TARGET_EMSCRIPTEN /* sRGB */ - SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, glConfiguration.isSRGBCapable()); + SDL_GL_SetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, glConfiguration.isSrgbCapable()); #endif /** @todo Remove when Emscripten has proper SDL2 support */ @@ -836,7 +836,7 @@ Sdl2Application::GLConfiguration::GLConfiguration(): _colorBufferSize{8, 8, 8, 0}, _depthBufferSize{24}, _stencilBufferSize{0}, _sampleCount(0) #ifndef CORRADE_TARGET_EMSCRIPTEN - , _version(GL::Version::None), _sRGBCapable{false} + , _version(GL::Version::None), _srgbCapable{false} #endif {} @@ -856,7 +856,7 @@ Sdl2Application::Configuration::Configuration(): #if defined(MAGNUM_BUILD_DEPRECATED) && defined(MAGNUM_TARGET_GL) , _sampleCount(0) #ifndef CORRADE_TARGET_EMSCRIPTEN - , _version(GL::Version::None), _sRGBCapable{false} + , _version(GL::Version::None), _srgbCapable{false} #endif #endif {} diff --git a/src/Magnum/Platform/Sdl2Application.h b/src/Magnum/Platform/Sdl2Application.h index a94e0c870..a047ab08a 100644 --- a/src/Magnum/Platform/Sdl2Application.h +++ b/src/Magnum/Platform/Sdl2Application.h @@ -1105,20 +1105,36 @@ class Sdl2Application::GLConfiguration { * * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten". */ - bool isSRGBCapable() const { return _sRGBCapable; } + bool isSrgbCapable() const { return _srgbCapable; } /** * @brief Set sRGB-capable default framebuffer * @return Reference to self (for method chaining) * * Default is @cpp false @ce. See also - * @ref GL::Renderer::Feature::FramebufferSRGB. + * @ref GL::Renderer::Feature::FramebufferSrgb. * @note Not available in @ref CORRADE_TARGET_EMSCRIPTEN "Emscripten". */ - GLConfiguration& setSRGBCapable(bool enabled) { - _sRGBCapable = enabled; + GLConfiguration& setSrgbCapable(bool enabled) { + _srgbCapable = enabled; return *this; } + + #ifdef MAGNUM_BUILD_DEPRECATED + /** + * @brief @copybrief isSrgbCapable() + * @deprecated Use @ref isSrgbCapable() instead. + */ + CORRADE_DEPRECATED("use isSrgbCapable() instead") bool isSRGBCapable() const { return isSrgbCapable(); } + + /** + * @brief @copybrief setSrgbCapable() + * @deprecated Use @ref setSrgbCapable() instead. + */ + CORRADE_DEPRECATED("use setSrgbCapable() instead") GLConfiguration& setSRGBCapable(bool enabled) { + return setSrgbCapable(enabled); + } + #endif #endif private: @@ -1128,7 +1144,7 @@ class Sdl2Application::GLConfiguration { #ifndef CORRADE_TARGET_EMSCRIPTEN GL::Version _version; Flags _flags; - bool _sRGBCapable; + bool _srgbCapable; #endif }; @@ -1493,16 +1509,16 @@ class Sdl2Application::Configuration { } #ifndef CORRADE_TARGET_EMSCRIPTEN - /** @brief @copybrief GLConfiguration::isSRGBCapable() - * @deprecated Use @ref GLConfiguration::isSRGBCapable() instead. + /** @brief @copybrief GLConfiguration::isSrgbCapable() + * @deprecated Use @ref GLConfiguration::isSrgbCapable() instead. */ - CORRADE_DEPRECATED("use GLConfiguration::isSRGBCapable() instead") bool isSRGBCapable() const { return _sRGBCapable; } + CORRADE_DEPRECATED("use GLConfiguration::isSrgbCapable() instead") bool isSRGBCapable() const { return _srgbCapable; } - /** @brief @copybrief GLConfiguration::setSRGBCapable() - * @deprecated Use @ref GLConfiguration::setSRGBCapable() instead. + /** @brief @copybrief GLConfiguration::setSrgbCapable() + * @deprecated Use @ref GLConfiguration::setSrgbCapable() instead. */ - CORRADE_DEPRECATED("use GLConfiguration::setSRGBCapable() instead") Configuration& setSRGBCapable(bool enabled) { - _sRGBCapable = enabled; + CORRADE_DEPRECATED("use GLConfiguration::setSrgbCapable() instead") Configuration& setSRGBCapable(bool enabled) { + _srgbCapable = enabled; return *this; } #endif @@ -1521,7 +1537,7 @@ class Sdl2Application::Configuration { #ifndef CORRADE_TARGET_EMSCRIPTEN GL::Version _version; Flags _flags; - bool _sRGBCapable; + bool _srgbCapable; #endif #endif };