class mrpt::opengl::CText

A 2D text that always “faces the observer” despite it having a real 3D position, used to compute its position on the screen, and depth (so it can be occluded).

Use setString() and setFont() to change the text and its appareance.

mrpt::opengl::CText

See also:

CText3D, opengl::COpenGLScene

#include <mrpt/opengl/CText.h>

class CText: public mrpt::opengl::CRenderizableShaderText
{
public:
    // construction

    CText(const std::string& str = std::string(""));

    //
methods

    void setString(const std::string& s);
    std::string getString() const;
    void setFont(const std::string& s, int height);
    std::string getFont() const;
    virtual shader_list_t requiredShaders() const;
    virtual void render(const RenderContext& rc) const;
    virtual mrpt::math::TBoundingBox getBoundingBox() const;
    std::pair<double, double> computeTextExtension() const;
    virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const;
};

Inherited Members

public:
    // structs

    struct RenderContext;

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual shader_list_t requiredShaders() const;
    virtual auto getBoundingBox() const = 0;
    virtual void freeOpenGLResources() = 0;
    virtual shader_list_t requiredShaders() const;
    virtual void render(const RenderContext& rc) const;
    virtual void renderUpdateBuffers() const;
    virtual void onUpdateBuffers_Text() = 0;
    virtual void freeOpenGLResources();

Construction

CText(const std::string& str = std::string(""))

Constructor.

Methods

void setString(const std::string& s)

Sets the text to display.

std::string getString() const

Return the current text associated to this label.

void setFont(const std::string& s, int height)

Sets the font among “sans”, “serif”, “mono”.

virtual shader_list_t requiredShaders() const

Returns the ID of the OpenGL shader program required to render this class.

See also:

DefaultShaderID

virtual void render(const RenderContext& rc) const

Implements the rendering of 3D objects in each class derived from CRenderizable.

This can be called more than once (one per required shader program) if the object registered several shaders.

See also:

renderUpdateBuffers

virtual mrpt::math::TBoundingBox getBoundingBox() const

Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.

virtual void toYAMLMap(mrpt::containers::yaml& propertiesMap) const

Used from COpenGLScene::asYAML().

(New in MRPT 2.4.2)