<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>mrpt::opengl::gl_utils Namespace Reference</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <div align="left"><a href="http://www.mrpt.org/">Main MRPT website</a> > <b>C++ reference</b> </div> <div align="right"> <a href="index.html"><img border="0" src="mrpt_logo.png" alt="MRPT logo"></a> </div> <!-- Generated by Doxygen 1.7.5 --> <script type="text/javascript"> var searchBox = new SearchBox("searchBox", "search",false,'Search'); </script> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li class="current"><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <div class="left"> <form id="FSearchBox" action="search.php" method="get"> <img id="MSearchSelect" src="search/mag.png" alt=""/> <input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)"/> </form> </div><div class="right"></div> </div> </li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="namespaces.html"><span>Namespace List</span></a></li> <li><a href="namespacemembers.html"><span>Namespace Members</span></a></li> </ul> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespacemrpt.html">mrpt</a> </li> <li class="navelem"><a class="el" href="namespacemrpt_1_1opengl.html">opengl</a> </li> <li class="navelem"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html">gl_utils</a> </li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#nested-classes">Classes</a> </div> <div class="headertitle"> <div class="title">mrpt::opengl::gl_utils Namespace Reference<div class="ingroups"><a class="el" href="group__mrpt__opengl__grp.html">[mrpt-opengl]</a></div></div> </div> </div> <div class="contents"> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><p>A set of auxiliary functions that can be called to render OpenGL primitives from MRPT or user code. </p> </div><table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structmrpt_1_1opengl_1_1gl__utils_1_1_t_render_info.html">TRenderInfo</a></td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Information about the rendering process being issued. <a href="structmrpt_1_1opengl_1_1gl__utils_1_1_t_render_info.html#details">More...</a><br/></td></tr> <tr><td colspan="2"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td colspan="2"><div class="groupHeader">Miscellaneous rendering methods</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a6f44cd8895c79190cc855902bdbd1647">renderSetOfObjects</a> (const <a class="el" href="namespacemrpt_1_1opengl.html#a2a98ed1cbee2bf526d35d6d3cc8ae9f6">mrpt::opengl::CListOpenGLObjects</a> &objs)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">For each object in the list: <a href="#a6f44cd8895c79190cc855902bdbd1647"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a364a7dbde49db4815f8b930d4114871a">checkOpenGLError</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Checks glGetError and throws an exception if an error situation is found. <a href="#a364a7dbde49db4815f8b930d4114871a"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a463454f7058a13593aeb1c78713a2dc6">renderTriangleWithNormal</a> (const <a class="el" href="structmrpt_1_1math_1_1_t_point3_d.html">mrpt::math::TPoint3D</a> &p1, const <a class="el" href="structmrpt_1_1math_1_1_t_point3_d.html">mrpt::math::TPoint3D</a> &p2, const <a class="el" href="structmrpt_1_1math_1_1_t_point3_d.html">mrpt::math::TPoint3D</a> &p3)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Can be used by derived classes to draw a triangle with a normal vector computed automatically - to be called within a glBegin()-glEnd() block. <a href="#a463454f7058a13593aeb1c78713a2dc6"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#adeeda3c1d38cc177f8bf58b77f2b13e6">getCurrentRenderingInfo</a> (<a class="el" href="structmrpt_1_1opengl_1_1gl__utils_1_1_t_render_info.html">TRenderInfo</a> &ri)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Gather useful information on the render parameters. <a href="#adeeda3c1d38cc177f8bf58b77f2b13e6"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#ac879b1d810641376723af2928c9a5a19">renderMessageBox</a> (const float msg_x, const float msg_y, const float msg_w, const float msg_h, const <a class="el" href="classstd_1_1string.html">std::string</a> &text, float text_scale, const <a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a> back_col=<a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a>(0, 0, 50, 150), const <a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a> border_col=<a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a>(0, 0, 0, 140), const <a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a> text_col=<a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a>(255, 255, 255, 220), const float border_width=4.0f, const std::string &text_font=std::string("sans"), mrpt::opengl::TOpenGLFontStyle text_style=mrpt::opengl::FILL, const double text_spacing=1.5, const double text_kerning=0.1)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Draws a message box with a centered (possibly multi-lined) text. <a href="#ac879b1d810641376723af2928c9a5a19"></a><br/></td></tr> <tr><td colspan="2"><div class="groupHeader">OpenGL bitmapped 2D fonts</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444">renderTextBitmap</a> (const char *str, void *fontStyle)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">This method is safe for calling from within ::render() methods. <a href="#a765b951c5dfac68de0300b0884327444"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a9eaa1ac5fcd5347d6a34f257a20bb5db">textBitmapWidth</a> (const <a class="el" href="classstd_1_1string.html">std::string</a> &str, <a class="el" href="group__mrpt__opengl__grp.html#ga4e54252970d0b0a6dd251335064a2346">mrpt::opengl::TOpenGLFont</a> font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Return the exact width in pixels for a given string, as will be rendered by <a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444" title="This method is safe for calling from within ::render() methods.">renderTextBitmap()</a>. <a href="#a9eaa1ac5fcd5347d6a34f257a20bb5db"></a><br/></td></tr> <tr><td colspan="2"><div class="groupHeader">OpenGL vector 3D fonts</div></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a2fea889ffc3bd42283ce9cd4c922f2ca">glSetFont</a> (const <a class="el" href="classstd_1_1string.html">std::string</a> &fontname)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">sets the font to use for future font rendering commands. <a href="#a2fea889ffc3bd42283ce9cd4c922f2ca"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">const OPENGL_IMPEXP <a class="el" href="classstd_1_1string.html">std::string</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#ad0749707fbbc6831fa7bf3b7fdb07b09">glGetFont</a> ()</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns the name of the currently active font <a href="#ad0749707fbbc6831fa7bf3b7fdb07b09"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmrpt_1_1utils_1_1_t_pixel_coordf.html">mrpt::utils::TPixelCoordf</a> <br class="typebreak"/> OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#adb0f347e8026263cd05fbe3e56631f5d">glDrawText</a> (const <a class="el" href="classstd_1_1string.html">std::string</a> &text, const double textScale, enum <a class="el" href="namespacemrpt_1_1opengl.html#a2a3950732480ac3cffe2c391a45fb4ef">TOpenGLFontStyle</a> style=NICE, double spacing=1.5, double kerning=0.1)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">renders a string in GL using the current settings. <a href="#adb0f347e8026263cd05fbe3e56631f5d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structmrpt_1_1utils_1_1_t_pixel_coordf.html">mrpt::utils::TPixelCoordf</a> <br class="typebreak"/> OPENGL_IMPEXP </td><td class="memItemRight" valign="bottom"><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a6f47f6cabc200bbea57f76265f024161">glGetExtends</a> (const <a class="el" href="classstd_1_1string.html">std::string</a> &text, const double textScale, double spacing=1.5, double kerning=0.1)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns the size of the bounding box of a text to be rendered, similar to <a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#adb0f347e8026263cd05fbe3e56631f5d">glDrawText</a> but without any visual output <a href="#a6f47f6cabc200bbea57f76265f024161"></a><br/></td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a364a7dbde49db4815f8b930d4114871a"></a><!-- doxytag: member="mrpt::opengl::gl_utils::checkOpenGLError" ref="a364a7dbde49db4815f8b930d4114871a" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::checkOpenGLError </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Checks glGetError and throws an exception if an error situation is found. </p> </div> </div> <a class="anchor" id="adeeda3c1d38cc177f8bf58b77f2b13e6"></a><!-- doxytag: member="mrpt::opengl::gl_utils::getCurrentRenderingInfo" ref="adeeda3c1d38cc177f8bf58b77f2b13e6" args="(TRenderInfo &ri)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::getCurrentRenderingInfo </td> <td>(</td> <td class="paramtype">TRenderInfo & </td> <td class="paramname"><em>ri</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Gather useful information on the render parameters. </p> <p>It can be called from within the render() method of CRenderizable-derived classes, and the returned matrices can be used to determine whether a given point (lx,ly,lz) in local coordinates wrt the object being rendered falls within the screen or not: </p> <div class="fragment"><pre class="fragment"> TRenderInfo ri; <a class="code" href="namespacemrpt_1_1opengl_1_1gl__utils.html#adeeda3c1d38cc177f8bf58b77f2b13e6" title="Gather useful information on the render parameters.">getCurrentRenderingInfo</a>(ri); Eigen::Matrix<float,4,4> M= ri.proj_matrix * ri.model_matrix * HomogeneousMatrix(lx,ly,lz); <span class="keyword">const</span> <span class="keywordtype">float</span> rend_x = M(0,3)/M(3,3); <span class="keyword">const</span> <span class="keywordtype">float</span> rend_y = M(1,3)/M(3,3); </pre></div><p> where (rend_x,rend_y) are both in the range [-1,1]. </p> </div> </div> <a class="anchor" id="adb0f347e8026263cd05fbe3e56631f5d"></a><!-- doxytag: member="mrpt::opengl::gl_utils::glDrawText" ref="adb0f347e8026263cd05fbe3e56631f5d" args="(const std::string &text, const double textScale, enum TOpenGLFontStyle style=NICE, double spacing=1.5, double kerning=0.1)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structmrpt_1_1utils_1_1_t_pixel_coordf.html">mrpt::utils::TPixelCoordf</a> OPENGL_IMPEXP mrpt::opengl::gl_utils::glDrawText </td> <td>(</td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>text</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>textScale</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">enum TOpenGLFontStyle </td> <td class="paramname"><em>style</em> = <code>NICE</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>spacing</em> = <code>1.5</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>kerning</em> = <code>0.1</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>renders a string in GL using the current settings. </p> <p>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. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">text</td><td>string to be rendered, unknown characters are replaced with '?' </td></tr> <tr><td class="paramname">textScale</td><td>The size of the characters (default=1.0) </td></tr> <tr><td class="paramname">style</td><td>rendering style </td></tr> <tr><td class="paramname">spacing</td><td>distance between individual text lines </td></tr> <tr><td class="paramname">kerning</td><td>distance between characters </td></tr> </table> </dd> </dl> <dl class="note"><dt><b>Note:</b></dt><dd>This functions comes from libcvd (LGPL, <a href="http://www.edwardrosten.com/cvd/">http://www.edwardrosten.com/cvd/</a> ) </dd></dl> </div> </div> <a class="anchor" id="a6f47f6cabc200bbea57f76265f024161"></a><!-- doxytag: member="mrpt::opengl::gl_utils::glGetExtends" ref="a6f47f6cabc200bbea57f76265f024161" args="(const std::string &text, const double textScale, double spacing=1.5, double kerning=0.1)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="structmrpt_1_1utils_1_1_t_pixel_coordf.html">mrpt::utils::TPixelCoordf</a> OPENGL_IMPEXP mrpt::opengl::gl_utils::glGetExtends </td> <td>(</td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>text</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>textScale</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>spacing</em> = <code>1.5</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">double </td> <td class="paramname"><em>kerning</em> = <code>0.1</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>returns the size of the bounding box of a text to be rendered, similar to <a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#adb0f347e8026263cd05fbe3e56631f5d">glDrawText</a> but without any visual output </p> <dl class="note"><dt><b>Note:</b></dt><dd>This functions comes from libcvd (LGPL, <a href="http://www.edwardrosten.com/cvd/">http://www.edwardrosten.com/cvd/</a> ) </dd></dl> </div> </div> <a class="anchor" id="ad0749707fbbc6831fa7bf3b7fdb07b09"></a><!-- doxytag: member="mrpt::opengl::gl_utils::glGetFont" ref="ad0749707fbbc6831fa7bf3b7fdb07b09" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">const OPENGL_IMPEXP <a class="el" href="classstd_1_1string.html">std::string</a>& mrpt::opengl::gl_utils::glGetFont </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>returns the name of the currently active font </p> </div> </div> <a class="anchor" id="a2fea889ffc3bd42283ce9cd4c922f2ca"></a><!-- doxytag: member="mrpt::opengl::gl_utils::glSetFont" ref="a2fea889ffc3bd42283ce9cd4c922f2ca" args="(const std::string &fontname)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::glSetFont </td> <td>(</td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>fontname</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>sets the font to use for future font rendering commands. </p> <p>currently sans, serif and mono are available. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">fontname</td><td>string containing font name </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="ac879b1d810641376723af2928c9a5a19"></a><!-- doxytag: member="mrpt::opengl::gl_utils::renderMessageBox" ref="ac879b1d810641376723af2928c9a5a19" args="(const float msg_x, const float msg_y, const float msg_w, const float msg_h, const std::string &text, float text_scale, const mrpt::utils::TColor back_col=mrpt::utils::TColor(0, 0, 50, 150), const mrpt::utils::TColor border_col=mrpt::utils::TColor(0, 0, 0, 140), const mrpt::utils::TColor text_col=mrpt::utils::TColor(255, 255, 255, 220), const float border_width=4.0f, const std::string &text_font=std::string("sans"), mrpt::opengl::TOpenGLFontStyle text_style=mrpt::opengl::FILL, const double text_spacing=1.5, const double text_kerning=0.1)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::renderMessageBox </td> <td>(</td> <td class="paramtype">const float </td> <td class="paramname"><em>msg_x</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const float </td> <td class="paramname"><em>msg_y</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const float </td> <td class="paramname"><em>msg_w</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const float </td> <td class="paramname"><em>msg_h</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>text</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">float </td> <td class="paramname"><em>text_scale</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a> </td> <td class="paramname"><em>back_col</em> = <code><a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a>(0, 0, 50, 150)</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a> </td> <td class="paramname"><em>border_col</em> = <code><a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a>(0, 0, 0, 140)</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a> </td> <td class="paramname"><em>text_col</em> = <code><a class="el" href="structmrpt_1_1utils_1_1_t_color.html">mrpt::utils::TColor</a>(255, 255, 255, 220)</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const float </td> <td class="paramname"><em>border_width</em> = <code>4.0f</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>text_font</em> = <code><a class="el" href="classstd_1_1string.html">std::string</a>("sans")</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="namespacemrpt_1_1opengl.html#a2a3950732480ac3cffe2c391a45fb4ef">mrpt::opengl::TOpenGLFontStyle</a> </td> <td class="paramname"><em>text_style</em> = <code>mrpt::opengl::FILL</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>text_spacing</em> = <code>1.5</code>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const double </td> <td class="paramname"><em>text_kerning</em> = <code>0.1</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Draws a message box with a centered (possibly multi-lined) text. </p> <p>It consists of a filled rectangle with a frame around and the centered text in the middle.</p> <p>The appearance of the box is highly configurable via parameters.</p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramdir">[in]</td><td class="paramname">msg_x,msg_y</td><td>The left-lower corner coordinates, in ratio [0,1] of the viewport size. (0,0) if the left-bottom corner of the viewport. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">msg_w,msg_h</td><td>The width & height, in ratio [0,1] of the viewport size. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">text</td><td>The text to display. Multiple lines can be drawn with the '<br/> ' character. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">text_scale</td><td>Size of characters, in ration [0,1] of the viewport size. Note that this size may be scaled automatically reduced to fit the text withtin the rectangle of the message box. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">back_col</td><td>Color of the rectangle background. Alpha can be <255 to enable transparency. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">border_col</td><td>Color of the rectangle frame. Alpha can be <255 to enable transparency. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">text_col</td><td>Color of the text background. Alpha can be <255 to enable transparency. </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">border_width</td><td>Width of the border, in pixels </td></tr> <tr><td class="paramdir">[in]</td><td class="paramname">text_font,text_style,text_spacing,text_kerning</td><td>See <a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#adb0f347e8026263cd05fbe3e56631f5d" title="renders a string in GL using the current settings.">mrpt::opengl::gl_utils::glDrawText()</a></td></tr> </table> </dd> </dl> <p>Example (see directory: 'samples/display3D_custom_render'):</p> <div class="image"> <img src="gl_utils_message_box.jpg" alt="gl_utils_message_box.jpg"/> </div> </div> </div> <a class="anchor" id="a6f44cd8895c79190cc855902bdbd1647"></a><!-- doxytag: member="mrpt::opengl::gl_utils::renderSetOfObjects" ref="a6f44cd8895c79190cc855902bdbd1647" args="(const mrpt::opengl::CListOpenGLObjects &objs)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::renderSetOfObjects </td> <td>(</td> <td class="paramtype">const <a class="el" href="namespacemrpt_1_1opengl.html#a2a98ed1cbee2bf526d35d6d3cc8ae9f6">mrpt::opengl::CListOpenGLObjects</a> & </td> <td class="paramname"><em>objs</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>For each object in the list: </p> <ul> <li>checks visibility of each object</li> <li>prepare the GL_MODELVIEW matrix according to its coordinates</li> <li>call its ::render()</li> <li>shows its name (if enabled).</li> </ul> <dl class="note"><dt><b>Note:</b></dt><dd>Used by <a class="el" href="classmrpt_1_1opengl_1_1_c_open_g_l_viewport.html" title="A viewport within a COpenGLScene, containing a set of OpenGL objects to render.">COpenGLViewport</a>, <a class="el" href="classmrpt_1_1opengl_1_1_c_set_of_objects.html" title="A set of object, which are referenced to the coordinates framework established in this object...">CSetOfObjects</a> </dd></dl> </div> </div> <a class="anchor" id="a765b951c5dfac68de0300b0884327444"></a><!-- doxytag: member="mrpt::opengl::gl_utils::renderTextBitmap" ref="a765b951c5dfac68de0300b0884327444" args="(const char *str, void *fontStyle)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::renderTextBitmap </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"><em>str</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">void * </td> <td class="paramname"><em>fontStyle</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>This method is safe for calling from within ::render() methods. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444" title="This method is safe for calling from within ::render() methods.">renderTextBitmap</a> </dd></dl> </div> </div> <a class="anchor" id="a463454f7058a13593aeb1c78713a2dc6"></a><!-- doxytag: member="mrpt::opengl::gl_utils::renderTriangleWithNormal" ref="a463454f7058a13593aeb1c78713a2dc6" args="(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void OPENGL_IMPEXP mrpt::opengl::gl_utils::renderTriangleWithNormal </td> <td>(</td> <td class="paramtype">const <a class="el" href="structmrpt_1_1math_1_1_t_point3_d.html">mrpt::math::TPoint3D</a> & </td> <td class="paramname"><em>p1</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structmrpt_1_1math_1_1_t_point3_d.html">mrpt::math::TPoint3D</a> & </td> <td class="paramname"><em>p2</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const <a class="el" href="structmrpt_1_1math_1_1_t_point3_d.html">mrpt::math::TPoint3D</a> & </td> <td class="paramname"><em>p3</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Can be used by derived classes to draw a triangle with a normal vector computed automatically - to be called within a glBegin()-glEnd() block. </p> </div> </div> <a class="anchor" id="a9eaa1ac5fcd5347d6a34f257a20bb5db"></a><!-- doxytag: member="mrpt::opengl::gl_utils::textBitmapWidth" ref="a9eaa1ac5fcd5347d6a34f257a20bb5db" args="(const std::string &str, mrpt::opengl::TOpenGLFont font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int OPENGL_IMPEXP mrpt::opengl::gl_utils::textBitmapWidth </td> <td>(</td> <td class="paramtype">const <a class="el" href="classstd_1_1string.html">std::string</a> & </td> <td class="paramname"><em>str</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="group__mrpt__opengl__grp.html#ga4e54252970d0b0a6dd251335064a2346">mrpt::opengl::TOpenGLFont</a> </td> <td class="paramname"><em>font</em> = <code>mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Return the exact width in pixels for a given string, as will be rendered by <a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444" title="This method is safe for calling from within ::render() methods.">renderTextBitmap()</a>. </p> <dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="namespacemrpt_1_1opengl_1_1gl__utils.html#a765b951c5dfac68de0300b0884327444" title="This method is safe for calling from within ::render() methods.">renderTextBitmap</a> </dd></dl> </div> </div> </div> <br><hr><br> <table border="0" width="100%"> <tr> <td> Page generated by <a href="http://www.doxygen.org" target="_blank">Doxygen 1.7.5</a> for MRPT 0.9.5 SVN: at Sun Sep 25 17:20:18 UTC 2011</td><td></td> <td width="100"> </td> <td width="150"> </td></tr> </table> </body></html>