/* +------------------------------------------------------------------------+ | Mobile Robot Programming Toolkit (MRPT) | | https://www.mrpt.org/ | | | | Copyright (c) 2005-2026, Individual contributors, see AUTHORS file | | See: https://www.mrpt.org/Authors - All rights reserved. | | Released under BSD License. See: https://www.mrpt.org/License | +------------------------------------------------------------------------+ */ // Stripped out version of libCVD gl-helpers.h file, ported to OpenGL>=3 // 2-BSD License. #pragma once #include #include #include #include #include #include #include #include #include namespace mrpt::opengl::internal { /** @name OpenGL vector 3D fonts @{ */ /// sets the font to use for future font rendering commands. /// Options are: "sans", "serif", "mono". /// @param fontname string containing font name void glSetFont(const std::string& fontname); /// returns the name of the currently active font const std::string& glGetFont(); /// different style for font rendering using TEXT_STYLE = TOpenGLFontStyle; /// 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 @ref spacing . /// Individual characters are separated by @ref kerning + plus their individual /// with. /// @param text string to be rendered, unknown characters are replaced with '?' /// @param style rendering style /// @param spacing distance between individual text lines /// @param kerning distance between characters std::pair glDrawText( const std::string& text, std::vector& tris, std::vector& lines, 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. void glDrawTextTransformed( const std::string& text, std::vector& tris, std::vector& lines, std::vector& 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); /// returns the size of the bounding box of a text to be rendered, similar to /// @ref glDrawText but without any visual output std::pair glGetExtends( const std::string& text, double spacing = 1.5, double kerning = 0.1); /** @} */ } // namespace mrpt::opengl::internal