Browse Source

Renamed various sRGB-related GL APIs for consistency with naming in Math.

As usual, the old names are deprecated aliases to the new things.
inverted-ranges
Vladimír Vondruš 8 years ago
parent
commit
674a740da5
  1. 12
      doc/changelog.dox
  2. 2
      doc/opengl-mapping.dox
  3. 2
      src/Magnum/GL/AbstractTexture.cpp
  4. 2
      src/Magnum/GL/AbstractTexture.h
  5. 19
      src/Magnum/GL/CubeMapTexture.h
  6. 17
      src/Magnum/GL/CubeMapTextureArray.h
  7. 17
      src/Magnum/GL/RectangleTexture.h
  8. 12
      src/Magnum/GL/Renderer.h
  9. 8
      src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp
  10. 8
      src/Magnum/GL/Test/CubeMapTextureGLTest.cpp
  11. 8
      src/Magnum/GL/Test/RectangleTextureGLTest.cpp
  12. 16
      src/Magnum/GL/Test/TextureArrayGLTest.cpp
  13. 24
      src/Magnum/GL/Test/TextureGLTest.cpp
  14. 15
      src/Magnum/GL/Texture.h
  15. 19
      src/Magnum/GL/TextureArray.h
  16. 2
      src/Magnum/Platform/GlfwApplication.cpp
  17. 32
      src/Magnum/Platform/GlfwApplication.h
  18. 6
      src/Magnum/Platform/Sdl2Application.cpp
  19. 42
      src/Magnum/Platform/Sdl2Application.h

12
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

2
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()

2
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);
}

2
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)

19
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)

17
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)

17
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)

12
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

8
src/Magnum/GL/Test/CubeMapTextureArrayGLTest.cpp

@ -49,7 +49,7 @@ struct CubeMapTextureArrayGLTest: OpenGLTester {
void bindImage();
template<class T> void sampling();
void samplingSRGBDecode();
void samplingSrgbDecode();
void samplingBorderInteger();
void samplingSwizzle();
void samplingDepthStencilMode();
@ -283,7 +283,7 @@ CubeMapTextureArrayGLTest::CubeMapTextureArrayGLTest() {
&CubeMapTextureArrayGLTest::sampling<GenericSampler>,
&CubeMapTextureArrayGLTest::sampling<GLSampler>,
&CubeMapTextureArrayGLTest::samplingSRGBDecode,
&CubeMapTextureArrayGLTest::samplingSrgbDecode,
&CubeMapTextureArrayGLTest::samplingBorderInteger,
&CubeMapTextureArrayGLTest::samplingSwizzle,
&CubeMapTextureArrayGLTest::samplingDepthStencilMode,
@ -462,7 +462,7 @@ template<class T> void CubeMapTextureArrayGLTest::sampling() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void CubeMapTextureArrayGLTest::samplingSRGBDecode() {
void CubeMapTextureArrayGLTest::samplingSrgbDecode() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_cube_map_array>())
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();
}

8
src/Magnum/GL/Test/CubeMapTextureGLTest.cpp

@ -56,7 +56,7 @@ struct CubeMapTextureGLTest: OpenGLTester {
template<class T> 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<GenericSampler>,
&CubeMapTextureGLTest::sampling<GLSampler>,
#ifndef MAGNUM_TARGET_WEBGL
&CubeMapTextureGLTest::samplingSRGBDecode,
&CubeMapTextureGLTest::samplingSrgbDecode,
#endif
#ifndef MAGNUM_TARGET_GLES2
&CubeMapTextureGLTest::samplingSwizzle,
@ -498,7 +498,7 @@ template<class T> void CubeMapTextureGLTest::sampling() {
}
#ifndef MAGNUM_TARGET_WEBGL
void CubeMapTextureGLTest::samplingSRGBDecode() {
void CubeMapTextureGLTest::samplingSrgbDecode() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::EXT::sRGB>())
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();
}

8
src/Magnum/GL/Test/RectangleTextureGLTest.cpp

@ -50,7 +50,7 @@ struct RectangleTextureGLTest: OpenGLTester {
void bindImage();
template<class T> void sampling();
void samplingSRGBDecode();
void samplingSrgbDecode();
void samplingBorderInteger();
void samplingSwizzle();
void samplingDepthStencilMode();
@ -118,7 +118,7 @@ RectangleTextureGLTest::RectangleTextureGLTest() {
&RectangleTextureGLTest::sampling<GenericSampler>,
&RectangleTextureGLTest::sampling<GLSampler>,
&RectangleTextureGLTest::samplingSRGBDecode,
&RectangleTextureGLTest::samplingSrgbDecode,
&RectangleTextureGLTest::samplingBorderInteger,
&RectangleTextureGLTest::samplingSwizzle,
&RectangleTextureGLTest::samplingDepthStencilMode,
@ -243,14 +243,14 @@ template<class T> void RectangleTextureGLTest::sampling() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void RectangleTextureGLTest::samplingSRGBDecode() {
void RectangleTextureGLTest::samplingSrgbDecode() {
if(!Context::current().isExtensionSupported<Extensions::ARB::texture_rectangle>())
CORRADE_SKIP(Extensions::ARB::texture_rectangle::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_sRGB_decode>())
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();
}

16
src/Magnum/GL/Test/TextureArrayGLTest.cpp

@ -70,9 +70,9 @@ struct TextureArrayGLTest: OpenGLTester {
template<class T> 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<GLSampler>,
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingSRGBDecode1D,
&TextureArrayGLTest::samplingSrgbDecode1D,
#endif
&TextureArrayGLTest::samplingSRGBDecode2D,
&TextureArrayGLTest::samplingSrgbDecode2D,
#ifndef MAGNUM_TARGET_GLES
&TextureArrayGLTest::samplingSwizzle1D,
@ -578,14 +578,14 @@ template<class T> void TextureArrayGLTest::sampling1D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void TextureArrayGLTest::samplingSRGBDecode1D() {
void TextureArrayGLTest::samplingSrgbDecode1D() {
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_array>())
CORRADE_SKIP(Extensions::EXT::texture_array::string() + std::string(" is not supported."));
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_sRGB_decode>())
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<class T> void TextureArrayGLTest::sampling2D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void TextureArrayGLTest::samplingSRGBDecode2D() {
void TextureArrayGLTest::samplingSrgbDecode2D() {
#ifndef MAGNUM_TARGET_GLES
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_array>())
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();
}

24
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<class T> void TextureGLTest::sampling1D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void TextureGLTest::samplingSRGBDecode1D() {
void TextureGLTest::samplingSrgbDecode1D() {
if(!Context::current().isExtensionSupported<Extensions::EXT::texture_sRGB_decode>())
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<class T> void TextureGLTest::sampling2D() {
}
#ifndef MAGNUM_TARGET_WEBGL
void TextureGLTest::samplingSRGBDecode2D() {
void TextureGLTest::samplingSrgbDecode2D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::EXT::sRGB>())
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<class T> void TextureGLTest::sampling3D() {
MAGNUM_VERIFY_NO_GL_ERROR();
}
void TextureGLTest::samplingSRGBDecode3D() {
void TextureGLTest::samplingSrgbDecode3D() {
#ifdef MAGNUM_TARGET_GLES2
if(!Context::current().isExtensionSupported<Extensions::OES::texture_3D>())
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();
}

15
src/Magnum/GL/Texture.h

@ -596,12 +596,21 @@ template<UnsignedInt dimensions> 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<dimensions>& setSRGBDecode(bool decode) {
AbstractTexture::setSRGBDecode(decode);
Texture<dimensions>& 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<dimensions>& setSRGBDecode(bool decode) {
return setSrgbDecode(decode);
}
#endif
#endif
#if !defined(MAGNUM_TARGET_GLES2) && !defined(MAGNUM_TARGET_WEBGL)

19
src/Magnum/GL/TextureArray.h

@ -399,20 +399,29 @@ template<UnsignedInt dimensions> 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<dimensions>& setSRGBDecode(bool decode) {
AbstractTexture::setSRGBDecode(decode);
TextureArray<dimensions>& 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<dimensions>& setSRGBDecode(bool decode) {
return setSrgbDecode(decode);
}
#endif
/**
* @brief @copybrief Texture::setSwizzle()
* @return Reference to self (for method chaining)

2
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

32
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;
}

6
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
{}

42
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
};

Loading…
Cancel
Save