class new in Git master
DistanceFieldGlyphCacheArrayGLOpenGL array glyph cache with distance field rendering.
Like DistanceFieldGlyphCacheGL, but backed by a GL::
Containers::Pointer<Text::AbstractFont> font = …; font->openFile("font.ttf", 48.0f); Text::DistanceFieldGlyphCacheArrayGL cache{{512, 512, 4}, {128, 128}, 12}; if(!font->fillGlyphCache(cache, "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789?!:;,. ")) Fatal{} << "Glyph cache too small to fit all characters";
Assuming a RendererGL is used with this cache for rendering the text, its mesh() can be then drawn using Shaders::
Text::RendererGL renderer{cache}; … Shaders::DistanceFieldVectorGL2D shader{ Shaders::DistanceFieldVectorGL2D::Configuration{} .setFlags(Shaders::DistanceFieldVectorGL2D::Flag::TextureArrays)}; shader … .bindVectorTexture(cache.texture()) .draw(renderer.mesh());
Base classes
- class GlyphCacheArrayGL new in Git master
- OpenGL array glyph cache.
Constructors, destructors, conversion operators
- DistanceFieldGlyphCacheArrayGL(const Vector3i& size, const Vector2i& processedSize, UnsignedInt radius) explicit
- Constructor.
- DistanceFieldGlyphCacheArrayGL(NoCreateT) explicit noexcept
- Construct without creating the internal state and the OpenGL texture object.
Public functions
- auto radius() const -> UnsignedInt
- Distance field calculation radius.
Function documentation
Magnum:: Text:: DistanceFieldGlyphCacheArrayGL:: DistanceFieldGlyphCacheArrayGL(const Vector3i& size,
const Vector2i& processedSize,
UnsignedInt radius) explicit
Constructor.
Parameters | |
---|---|
size | Size of the source image |
processedSize | Resulting distance field texture size. Depth of the resulting texture is size.z() . |
radius | Distance field calculation radius |
See TextureTools::size.xy()
and processedSize
is expected to be a multiple of 2.
Sets the processedFormat() to PixelFormat::
Magnum:: Text:: DistanceFieldGlyphCacheArrayGL:: DistanceFieldGlyphCacheArrayGL(NoCreateT) explicit noexcept
Construct without creating the internal state and the OpenGL texture object.
The constructed instance is equivalent to moved-from state, i.e. no APIs can be safely called on the object. Useful in cases where you will overwrite the instance later anyway. Move another object over it to make it useful.
This function can be safely used for constructing (and later destructing) objects even without any OpenGL context being active. However note that this is a low-level and a potentially dangerous API, see the documentation of NoCreate for alternatives.