namespace mrpt::opengl::internal

namespace internal {

// typedefs

typedef TOpenGLFontStyle TEXT_STYLE;

// structs

struct Font;
struct FontData;
struct Point;
struct RenderElements;

// global variables

Point mono_vertices[];
Font::Index mono_triangles[];
Font::Index mono_lines[];
Font::Char mono_chars[];
Font mono_font = {mono_vertices, mono_triangles, mono_lines, mono_chars,                  " $(,048<@DHLPTX\\`dhlptx|#'+/"                 "37;?CGKOSW[_cgkosw{\"&*.26:>BFJNRVZ^bfjnrvz~\t!%)-159="                "AEIMQUY]aeimquy}"};
Point sans_vertices[];
Font::Index sans_triangles[];
Font::Index sans_lines[];
Font::Char sans_chars[];
Font sans_font = {sans_vertices, sans_triangles, sans_lines, sans_chars,                  " $(,048<@DHLPTX\\`dhlptx|#'+/"                 "37;?CGKOSW[_cgkosw{\"&*.26:>BFJNRVZ^bfjnrvz~\t!%)-159="                "AEIMQUY]aeimquy}"};
Point serif_vertices[];
Font::Index serif_triangles[];
Font::Index serif_lines[];
Font::Char serif_chars[];
Font serif_font = {serif_vertices, serif_triangles, serif_lines, serif_chars,                  " $(,048<@DHLPTX\\`dhlptx|#'+/"                 "37;?CGKOSW[_cgkosw{\"&*.26:>BFJNRVZ^bfjnrvz~\t!%)-159="                    "AEIMQUY]aeimquy}"};
static struct FontData data;
static std::list<Program> pendingToClear;
static std::mutex pendingToClear_mtx;

// global functions

void glSetFont(const std::string& fontname);
const std::string& glGetFont();

std::pair<double, double> glDrawText(
    const std::string& text,
    std::vector<mrpt::opengl::TTriangle>& tris,
    std::vector<mrpt::math::TPoint3Df>& lines,
    TEXT_STYLE style = NICE,
    double spacing = 1.5,
    double kerning = 0.1
    );

std::pair<double, double> glGetExtends(
    const std::string& text,
    double spacing,
    double kerning
    );

void glDrawTextTransformed(
    const std::string& text,
    std::vector<mrpt::opengl::TTriangle>& tris,
    std::vector<mrpt::math::TPoint3Df>& lines,
    std::vector<mrpt::img::TColor>& line_colors,
    const mrpt::poses::CPose3D& text_pose,
    float text_scale,
    const mrpt::img::TColor& text_color,
    TEXT_STYLE style = NICE,
    double spacing = 1.5,
    double kerning = 0.1
    );

void clearPendingIfPossible();

} // namespace internal

Typedefs

typedef TOpenGLFontStyle TEXT_STYLE

different style for font rendering

Global Functions

void glSetFont(const std::string& fontname)

sets the font to use for future font rendering commands.

Options are: “sans”, “serif”, “mono”.

Parameters:

fontname

string containing font name

const std::string& glGetFont()

returns the name of the currently active font

std::pair<double, double> glDrawText(
    const std::string& text,
    std::vector<mrpt::opengl::TTriangle>& tris,
    std::vector<mrpt::math::TPoint3Df>& lines,
    TEXT_STYLE style = NICE,
    double spacing = 1.5,
    double kerning = 0.1
    )

renders a string in GL using the current settings.

Font coordinates are +X along the line and +Y along the up direction of glyphs. The origin is at the top baseline at the left of the first character. Characters have a maximum size of 1. linefeed is interpreted as a new line and the start is offset in -Y direction by spacing . Individual characters are separated by kerning + plus their individual with.

Parameters:

text

string to be rendered, unknown characters are replaced with ‘?’

style

rendering style

spacing

distance between individual text lines

kerning

distance between characters

std::pair<double, double> glGetExtends(
    const std::string& text,
    double spacing,
    double kerning
    )

returns the size of the bounding box of a text to be rendered, similar to glDrawText but without any visual output

void glDrawTextTransformed(
    const std::string& text,
    std::vector<mrpt::opengl::TTriangle>& tris,
    std::vector<mrpt::math::TPoint3Df>& lines,
    std::vector<mrpt::img::TColor>& line_colors,
    const mrpt::poses::CPose3D& text_pose,
    float text_scale,
    const mrpt::img::TColor& text_color,
    TEXT_STYLE style = NICE,
    double spacing = 1.5,
    double kerning = 0.1
    )

Appends to {tris,lines} the entities representing a given text including a pose and scale transformation.

It calls glDrawText() and appends its results to the provided buffers.