Go to the documentation of this file.
25 void CTextMessageCapable::render_text_messages(
const int w,
const int h)
const
27 #if MRPT_HAS_OPENGL_GLUT
29 GLint old_matMode = 0;
44 it != m_2D_texts.end(); ++it)
48 const int x = it->second.x >= 1
50 : (it->second.x < 0 ? int(
w + it->second.x)
51 : int(it->second.x *
w));
52 const int y = it->second.y >= 1
54 : (it->second.y < 0 ? int(h + it->second.y)
55 : int(it->second.y * h));
58 double font_size = 10;
59 string font_name =
"sans";
61 double font_spacing = 1.5;
62 double font_kerning = 0.1;
64 switch (it->second.font)
90 font_size = it->second.vfont_scale;
91 font_name = it->second.vfont_name;
92 font_style = it->second.vfont_style;
93 font_spacing = it->second.vfont_spacing;
94 font_kerning = it->second.vfont_kerning;
98 std::cerr <<
"[CTextMessageCapable::render_text_messages] "
99 "Invalid value for TOpenGLFont\n";
103 if (it->second.draw_shadow)
110 it->second.shadow_color.R, it->second.shadow_color.G,
111 it->second.shadow_color.B);
114 it->second.text, font_size, font_style, font_spacing,
124 glColor3f(it->second.color.R, it->second.color.G, it->second.color.B);
127 it->second.text, font_size, font_style, font_spacing, font_kerning);
145 void CTextMessageCapable::clearTextMessages() { m_2D_texts.clear(); }
146 void CTextMessageCapable::addTextMessage(
147 const double x_frac,
const double y_frac,
const std::string& text,
158 m_2D_texts[unique_index] = d;
165 bool CTextMessageCapable::updateTextMessage(
166 const size_t unique_index,
const std::string& text)
169 m_2D_texts.find(unique_index);
170 if (it == m_2D_texts.end())
174 it->second.text = text;
181 void CTextMessageCapable::addTextMessage(
182 const double x_frac,
const double y_frac,
const std::string& text,
185 const size_t unique_index,
const double font_spacing,
186 const double font_kerning,
const bool has_shadow,
203 m_2D_texts[unique_index] = d;
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
const Scalar * const_iterator
GLAPI void GLAPIENTRY glPopMatrix(void)
TOpenGLFontStyle
Different style for vectorized font rendering.
mrpt::img::TPixelCoordf glDrawText(const std::string &text, const double textScale, enum TOpenGLFontStyle style=NICE, double spacing=1.5, double kerning=0.1)
renders a string in GL using the current settings.
@ MRPT_GLUT_BITMAP_HELVETICA_10
void glSetFont(const std::string &fontname)
sets the font to use for future font rendering commands.
GLAPI void GLAPIENTRY glDisable(GLenum cap)
#define MRPT_UNUSED_PARAM(a)
Determines whether this is an X86 or AMD64 platform.
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLubyte GLubyte GLubyte GLubyte w
TOpenGLFontStyle vfont_style
(default: NICE) See TOpenGLFontStyle.
@ MRPT_GLUT_BITMAP_HELVETICA_12
GLAPI void GLAPIENTRY glColor3f(GLfloat red, GLfloat green, GLfloat blue)
GLAPI void GLAPIENTRY glPushMatrix(void)
@ MRPT_GLUT_BITMAP_HELVETICA_18
mrpt::img::TColorf shadow_color
double vfont_scale
Size of characters.
An auxiliary struct for holding a list of text messages in some mrpt::opengl & mrpt::gui classes The ...
A RGB color - floats in the range [0,1].
double vfont_spacing
(default: 1.5) Refer to mrpt::opengl::gl_utils::glDrawText
double vfont_kerning
(default: 0.1) Refer to mrpt::opengl::gl_utils::glDrawText
GLAPI void GLAPIENTRY glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
@ FILL
renders glyphs as filled polygons
GLAPI void GLAPIENTRY glGetIntegerv(GLenum pname, GLint *params)
GLAPI void GLAPIENTRY glLoadIdentity(void)
mrpt::opengl::TOpenGLFont font
@ MRPT_GLUT_BITMAP_TIMES_ROMAN_10
GLAPI void GLAPIENTRY glMatrixMode(GLenum mode)
std::string vfont_name
Vectorized font name ("sans","mono","serif")
GLsizei const GLchar ** string
The namespace for 3D scene representation and rendering.
@ MRPT_GLUT_BITMAP_TIMES_ROMAN_24
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |