Magnum::Text::RendererGL class new in Git master

OpenGL text renderer.

Specialization of a Renderer that uploads index and vertex data to a GL::Mesh. See the Renderer class documentation for information about setting up an instance of this class, filling it with data and drawing the text with it.

Base classes

class Renderer new in Git master
Text renderer.

Constructors, destructors, conversion operators

RendererGL(const AbstractGlyphCache& glyphCache, RendererGLFlags flags = {}) explicit
Construct.
RendererGL(NoCreateT) explicit noexcept
Construct without creating the internal state and the OpenGL objects.
RendererGL(RendererGL&) deleted
Copying is not allowed.
RendererGL(RendererGL&&) noexcept
Move constructor.

Public functions

auto operator=(RendererGL&) -> RendererGL& deleted
Copying is not allowed.
auto operator=(RendererGL&&) -> RendererGL& noexcept
Move assignment.
auto flags() const -> RendererGLFlags
Flags.
auto mesh() -> GL::Mesh&
Mesh containing the rendered index and vertex data.
auto mesh() const -> const GL::Mesh&
auto setIndexType(MeshIndexType atLeast) -> RendererGL&
Set index type.
auto reserve(UnsignedInt glyphCapacity, UnsignedInt runCapacity) -> RendererGL&
Reserve capacity for given glyph count.
auto clear() -> RendererGL&
Clear rendered glyphs, runs and vertices.
auto reset() -> RendererGL&
Reset internal renderer state.
auto render() -> Containers::Pair<Range2D, Range1Dui>
Wrap up rendering of all text added so far.

Function documentation

Magnum::Text::RendererGL::RendererGL(const AbstractGlyphCache& glyphCache, RendererGLFlags flags = {}) explicit

Construct.

Parameters
glyphCache Glyph cache to use
flags Opt-in feature flags

Unlike with the Renderer base, the OpenGL implementation needs to have a complete control over memory layout and allocation and thus it isn't possible to supply custom allocators. If you want the control, use Renderer with custom index and vertex allocators and fill a GL::Mesh instance with the data manually.

Magnum::Text::RendererGL::RendererGL(NoCreateT) explicit noexcept

Construct without creating the internal state and the OpenGL objects.

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.

Magnum::Text::RendererGL::RendererGL(RendererGL&&) noexcept

Move constructor.

Performs a destructive move, i.e. the original object isn't usable afterwards anymore.

const GL::Mesh& Magnum::Text::RendererGL::mesh() const

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

RendererGL& Magnum::Text::RendererGL::setIndexType(MeshIndexType atLeast)

Set index type.

Returns Reference to self (for method chaining)

Calls Renderer::setIndexType() and updates mesh() with the rendered index data, if different from before. Compared to Renderer, the default index type is MeshIndexType::UnsignedShort, not MeshIndexType::UnsignedByte, as use of 8-bit indices is discouraged on contemporary GPUs.

RendererGL& Magnum::Text::RendererGL::reserve(UnsignedInt glyphCapacity, UnsignedInt runCapacity)

Reserve capacity for given glyph count.

Returns Reference to self (for method chaining)

Calls Renderer::reserve() and updates mesh() with the rendered index data, if different from before.

RendererGL& Magnum::Text::RendererGL::clear()

Clear rendered glyphs, runs and vertices.

Returns Reference to self (for method chaining)

Calls Renderer::clear() and additionally also sets mesh() index count to 0.

RendererGL& Magnum::Text::RendererGL::reset()

Reset internal renderer state.

Returns Reference to self (for method chaining)

Calls Renderer::reset(), and additionally also sets mesh() index count to 0.

Containers::Pair<Range2D, Range1Dui> Magnum::Text::RendererGL::render()

Wrap up rendering of all text added so far.

Calls Renderer::render(), updates mesh() with the newly rendered vertex data and potentially updates also the index data, if different from before.