SOFA API  1a4bb3e7
Open source framework for multi-physics simuation
sofa::gl::GlText Class Reference

#include <glText.h>

Detailed Description

This class, called GlText, allows to render text in OpenGL, always facing the camera in 2D (screen) or in 3D (world coordinates)

Public Member Functions

 GlText ()
 Constructor. More...
 
 GlText (const std::string &text)
 Constructor with specified text. More...
 
 GlText (const std::string &text, const type::Vec3 &position)
 Constructor with specified text and position. More...
 
 GlText (const std::string &text, const type::Vec3 &position, const double &scale)
 Constructor with specified text, position and scale. More...
 
 ~GlText ()
 Destructor. More...
 
void setText (const std::string &text)
 Update the text to render. More...
 
template<typename T >
void setText (const T &text)
 Update the text to render. More...
 
void update (const type::Vec3 &position)
 Update the position used to render the text. More...
 
void update (const double &scale)
 Update the scale used to render the text. More...
 
void draw ()
 Render the text at the defined position and scale. More...
 

Static Public Member Functions

template<typename T >
static void draw (const T &text, const type::Vec3 &position=type::Vec3(0.0, 0.0, 0.0), const double &scale=1.0)
 Render the text at the defined position and scale. More...
 
static void textureDraw_Overlay (const char *text, const double scale=1.0)
 
static void textureDraw_Indices (const type::vector< type::Vec3 > &positions, const float &scale)
 

Constructor details

◆ GlText() [1/4]

sofa::gl::GlText::GlText ( )

Constructor.

◆ GlText() [2/4]

sofa::gl::GlText::GlText ( const std::string &  text)

Constructor with specified text.

◆ GlText() [3/4]

sofa::gl::GlText::GlText ( const std::string &  text,
const type::Vec3 position 
)

Constructor with specified text and position.

◆ GlText() [4/4]

sofa::gl::GlText::GlText ( const std::string &  text,
const type::Vec3 position,
const double &  scale 
)

Constructor with specified text, position and scale.

◆ ~GlText()

sofa::gl::GlText::~GlText ( )

Destructor.

Function details

◆ draw() [1/2]

void sofa::gl::GlText::draw ( )

Render the text at the defined position and scale.

◆ draw() [2/2]

template<typename T >
void sofa::gl::GlText::draw ( const T &  text,
const type::Vec3 position = type::Vec3(0.0,0.0,0.0),
const double &  scale = 1.0 
)
static

Render the text at the defined position and scale.

◆ setText() [1/2]

void sofa::gl::GlText::setText ( const std::string &  text)

Update the text to render.

◆ setText() [2/2]

template<typename T >
void sofa::gl::GlText::setText ( const T &  text)

Update the text to render.

◆ textureDraw_Indices()

void sofa::gl::GlText::textureDraw_Indices ( const type::vector< type::Vec3 > &  positions,
const float scale 
)
static

◆ textureDraw_Overlay()

void sofa::gl::GlText::textureDraw_Overlay ( const char text,
const double  scale = 1.0 
)
static

◆ update() [1/2]

void sofa::gl::GlText::update ( const double &  scale)

Update the scale used to render the text.

◆ update() [2/2]

void sofa::gl::GlText::update ( const type::Vec3 position)

Update the position used to render the text.