diff --git a/src/SFML/Graphics/RenderTexture.cpp b/src/SFML/Graphics/RenderTexture.cpp index fc33c1d94..d66c31d27 100644 --- a/src/SFML/Graphics/RenderTexture.cpp +++ b/src/SFML/Graphics/RenderTexture.cpp @@ -58,6 +58,9 @@ bool RenderTexture::create(unsigned int width, unsigned int height, bool depthBu //////////////////////////////////////////////////////////// bool RenderTexture::create(unsigned int width, unsigned int height, const ContextSettings& settings) { + // Set texture to be in sRGB scale if requested + m_texture.setSrgb(settings.sRgbCapable); + // Create the texture if (!m_texture.create(width, height)) { diff --git a/src/SFML/Graphics/RenderTextureImplFBO.cpp b/src/SFML/Graphics/RenderTextureImplFBO.cpp index 432208fa9..bd83d6a52 100644 --- a/src/SFML/Graphics/RenderTextureImplFBO.cpp +++ b/src/SFML/Graphics/RenderTextureImplFBO.cpp @@ -296,6 +296,7 @@ bool RenderTextureImplFBO::create(unsigned int width, unsigned int height, unsig #ifndef SFML_OPENGL_ES // Create the multisample color buffer + bool srgb = settings.sRgbCapable && GLEXT_texture_sRGB; GLuint color = 0; glCheck(GLEXT_glGenRenderbuffers(1, &color)); m_colorBuffer = static_cast(color); @@ -305,7 +306,7 @@ bool RenderTextureImplFBO::create(unsigned int width, unsigned int height, unsig return false; } glCheck(GLEXT_glBindRenderbuffer(GLEXT_GL_RENDERBUFFER, m_colorBuffer)); - glCheck(GLEXT_glRenderbufferStorageMultisample(GLEXT_GL_RENDERBUFFER, settings.antialiasingLevel, GL_RGBA, width, height)); + glCheck(GLEXT_glRenderbufferStorageMultisample(GLEXT_GL_RENDERBUFFER, settings.antialiasingLevel, srgb ? GL_SRGB8_ALPHA8_EXT : GL_RGBA, width, height)); // Create the multisample depth/stencil buffer if requested if (settings.stencilBits)