Go to the documentation of this file.
9 #ifndef opengl_glutils_H
10 #define opengl_glutils_H
15 #ifndef opengl_CRenderizable_H
37 int vp_x,
vp_y, vp_width, vp_height;
47 void projectPoint(
float x,
float y,
float z,
float &proj_x,
float &proj_y,
float &proj_z_depth)
const
49 const Eigen::Matrix<float,4,1,Eigen::ColMajor> proj = full_matrix * Eigen::Matrix<float,4,1,Eigen::ColMajor>(x,y,z,1);
50 proj_x = proj[3] ? proj[0]/proj[3] : 0;
51 proj_y = proj[3] ? proj[1]/proj[3] : 0;
52 proj_z_depth = proj[2];
56 void projectPointPixels(
float x,
float y,
float z,
float &proj_x_px,
float &proj_y_px,
float &proj_z_depth)
const
58 projectPoint(x,y,z,proj_x_px,proj_y_px,proj_z_depth);
59 proj_x_px = (proj_x_px+1.0f)*(vp_width/2.0f);
60 proj_y_px = (proj_y_px+1.0f)*(vp_height/2.0f);
127 const float msg_x,
const float msg_y,
128 const float msg_w,
const float msg_h,
129 const std::string &text,
134 const float border_width = 4.0f,
135 const std::string & text_font = std::string(
"sans"),
137 const double text_spacing = 1.5,
138 const double text_kerning = 0.1
153 const std::string &str,
Lightweight 3D point (float version).
TOpenGLFont
Existing fonts for 2D texts in mrpt::opengl methods.
void OPENGL_IMPEXP getCurrentRenderingInfo(TRenderInfo &ri)
Gather useful information on the render parameters.
TOpenGLFontStyle
Different style for vectorized font rendering.
const OPENGL_IMPEXP std::string & glGetFont()
returns the name of the currently active font
renders glyphs filled with antialiased outlines
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > proj_matrix
The 4x4 projection matrix.
void OPENGL_IMPEXP glSetFont(const std::string &fontname)
sets the font to use for future font rendering commands.
void projectPointPixels(float x, float y, float z, float &proj_x_px, float &proj_y_px, float &proj_z_depth) const
Exactly like projectPoint but the (x,y) projected coordinates are given in pixels instead of normaliz...
void OPENGL_IMPEXP renderMessageBox(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)
Draws a message box with a centered (possibly multi-lined) text.
std::deque< CRenderizablePtr > CListOpenGLObjects
A list of objects pointers, automatically managing memory free at destructor, and managing copies cor...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Information about the rendering process being issued.
void OPENGL_IMPEXP renderTriangleWithNormal(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3)
Can be used by derived classes to draw a triangle with a normal vector computed automatically - to be...
void OPENGL_IMPEXP checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
void OPENGL_IMPEXP renderTextBitmap(const char *str, void *fontStyle)
This method is safe for calling from within ::render() methods.
int OPENGL_IMPEXP textBitmapWidth(const std::string &str, mrpt::opengl::TOpenGLFont font=mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24)
Return the exact width in pixels for a given string, as will be rendered by renderTextBitmap().
renders glyphs as filled polygons
mrpt::utils::TPixelCoordf OPENGL_IMPEXP 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.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > full_matrix
PROJ * MODEL.
mrpt::math::TPoint3Df camera_position
The 3D location of the camera.
void projectPoint(float x, float y, float z, float &proj_x, float &proj_y, float &proj_z_depth) const
Computes the normalized coordinates (range=[0,1]) on the current rendering viewport of a point with l...
void OPENGL_IMPEXP renderQuadWithNormal(const mrpt::math::TPoint3Df &p1, const mrpt::math::TPoint3Df &p2, const mrpt::math::TPoint3Df &p3, const mrpt::math::TPoint3Df &p4)
Can be used by derived classes to draw a quad with a normal vector computed automatically - to be cal...
A pair (x,y) of pixel coordinates (subpixel resolution).
void OPENGL_IMPEXP renderSetOfObjects(const mrpt::opengl::CListOpenGLObjects &objs)
For each object in the list:
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > model_matrix
The 4x4 model transformation matrix.
mrpt::utils::TPixelCoordf OPENGL_IMPEXP glGetExtends(const std::string &text, const double textScale, double spacing=1.5, double kerning=0.1)
returns the size of the bounding box of a text to be rendered, similar to glDrawText but without any ...
Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 22:32:58 UTC 2019 | | |