Browse Source

Text: prevent minor DistanceFieldGlyphCacheGL differences on ES2.

And hint that in TextureTools::DistanceFieldGL docs as well.
pull/419/merge
Vladimír Vondruš 2 years ago
parent
commit
13fff0a3eb
  1. 6
      src/Magnum/Text/DistanceFieldGlyphCacheGL.cpp
  2. 5
      src/Magnum/TextureTools/DistanceFieldGL.h

6
src/Magnum/Text/DistanceFieldGlyphCacheGL.cpp

@ -89,8 +89,10 @@ GlyphCacheFeatures DistanceFieldGlyphCacheGL::doFeatures() const {
void DistanceFieldGlyphCacheGL::doSetImage(const Vector2i& offset, const ImageView2D& image) {
GL::Texture2D input;
input.setWrapping(GL::SamplerWrapping::ClampToEdge)
.setMinificationFilter(GL::SamplerFilter::Linear)
.setMagnificationFilter(GL::SamplerFilter::Linear);
/* Use nearest filter to avoid minor rounding errors on ES2 compared to
texelFetch() on ES3+ */
.setMinificationFilter(GL::SamplerFilter::Nearest, GL::SamplerMipmap::Base)
.setMagnificationFilter(GL::SamplerFilter::Nearest);
/* The constructor already checked that the ratio is an integer multiple,
so this division should lead to no information loss */

5
src/Magnum/TextureTools/DistanceFieldGL.h

@ -155,6 +155,11 @@ class MAGNUM_TEXTURETOOLS_EXPORT DistanceFieldGL {
* OpenGL ES) and @p rectangle size is expected to be a multiple of 2,
* as that's what the generator shader relies on for correct pixel
* addressing.
*
* @attention For consistent results on implementations that don't
* support @glsl texelFetch() @ce and have rely on regular texture
* filtering it's recommended to use @ref GL::SamplerFilter::Nearest
* on the @p input.
*/
#ifdef DOXYGEN_GENERATING_OUTPUT
void operator()(GL::Texture2D& input, GL::Framebuffer& output, const Range2Di& rectangle, const Vector2i& imageSize

Loading…
Cancel
Save