diff --git a/doc/changelog.dox b/doc/changelog.dox index 2037a4cce..4b9b1d43b 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -138,6 +138,14 @@ See also: now expect that the mesh is indexed (instead of silently not doing anything) +@subsubsection changelog-latest-changes-text Text library + +- The @ref Text::GlyphCache now unconditionally uses + @ref GL::TextureFormat::Luminance on ES2 and WebGL 1, instead of trying + @ref GL::TextureFormat::Red there first. That's done for consistency with + @ref GL::pixelFormat(), which unconditionally returns + @ref GL::PixelFormat::Luminance for @ref PixelFormat::R8Unorm. + @subsubsection changelog-latest-changes-plugins Plugins - @ref Trade::TgaImporter "TgaImporter" and diff --git a/src/Magnum/Text/GlyphCache.cpp b/src/Magnum/Text/GlyphCache.cpp index bd20e9bcf..bb19a5cc2 100644 --- a/src/Magnum/Text/GlyphCache.cpp +++ b/src/Magnum/Text/GlyphCache.cpp @@ -46,15 +46,8 @@ GlyphCache::GlyphCache(const Vector2i& originalSize, const Vector2i& size, const MAGNUM_ASSERT_GL_EXTENSION_SUPPORTED(GL::Extensions::ARB::texture_rg); #endif - /** @todo Is there any better way to select proper sized/unsized format on ES2? */ #ifndef MAGNUM_TARGET_GLES2 const GL::TextureFormat internalFormat = GL::TextureFormat::R8; - #elif !defined(MAGNUM_TARGET_WEBGL) - GL::TextureFormat internalFormat; - if(GL::Context::current().isExtensionSupported()) { - internalFormat = GL::Context::current().isExtensionSupported() ? - GL::TextureFormat::R8 : GL::TextureFormat::Red; - } else internalFormat = GL::TextureFormat::Luminance; #else const GL::TextureFormat internalFormat = GL::TextureFormat::Luminance; #endif diff --git a/src/Magnum/Text/GlyphCache.h b/src/Magnum/Text/GlyphCache.h index a56a42d47..08ce21965 100644 --- a/src/Magnum/Text/GlyphCache.h +++ b/src/Magnum/Text/GlyphCache.h @@ -81,9 +81,13 @@ class MAGNUM_TEXT_EXPORT GlyphCache { * @brief Constructor * * Sets internal texture format to red channel only. On desktop OpenGL - * requires @extension{ARB,texture_rg} (also part of OpenGL ES 3.0), in - * ES2 uses @extension{EXT,texture_rg}, if available, or - * @ref GL::TextureFormat::Luminance as fallback. + * requires @extension{ARB,texture_rg} (also part of OpenGL ES 3.0 and + * WebGL 2), on ES2 unconditionally uses @ref GL::TextureFormat::Luminance. + * This is done for consistency with @ref GL::pixelFormat(), which + * unconditionally returns @ref GL::PixelFormat::Luminance for + * @ref PixelFormat::R8Unorm. See + * @ref GlyphCache(GL::TextureFormat, const Vector2i&, const Vector2i&) + * for an alternative. */ explicit GlyphCache(const Vector2i& originalSize, const Vector2i& size, const Vector2i& padding);