MRPT  1.9.9
[mrpt-opengl]

Detailed Description

Visualization helpers for 3D rendering of all kind of primitives.

Back to list of all libraries | See all modules

Library `mrpt-opengl`

This library is part of MRPT and can be installed in Debian-based systems with:

    sudo apt install libmrpt-opengl-dev

See: Using MRPT from your CMake project

This library includes several data classes that represent objects that can be inserted into a 3D scene, which can be then rendered or streamed to disk or whatever.

A good starting point to explore this library is the base class for all the 3D objects: mrpt::opengl::CRenderizable

A 3D scene is represented by an object of the type mrpt::opengl::COpenGLScene, which in turn can contain one or several "viewports" in such a way that the rendering area is divided into several spaces, each displaying the same or different objects. See the tutorial online: https://www.mrpt.org/Tutorial_3D_Scenes

See the full list of classes in mrpt::opengl.

Below follows a table with the preview of most rendering primitive classes:

mrpt::opengl::CArrow
preview_CArrow.png
mrpt::opengl::CAssimpModel
preview_CAssimpModel.png
mrpt::opengl::CAxis
preview_CAxis.png
mrpt::opengl::CBox
preview_CBox.png
mrpt::opengl::CFrustum
preview_CFrustum.png
mrpt::opengl::CCylinder
preview_CCylinder.png
mrpt::opengl::CDisk
preview_CDisk.png
mrpt::opengl::CEllipsoid
preview_CEllipsoid.png
mrpt::opengl::CGridPlaneXY
preview_CGridPlaneXY.png
mrpt::opengl::CGridPlaneXZ
preview_CGridPlaneXZ.png
mrpt::opengl::CMesh
preview_CMesh.png
mrpt::opengl::CMesh3D
preview_CMesh3D.png
mrpt::opengl::CMeshFast
preview_CMeshFast.png
mrpt::opengl::CPointCloud
preview_CPointCloud.png
mrpt::opengl::CPointCloudColoured
preview_CPointCloudColoured.png
mrpt::opengl::CPolyhedron
preview_CPolyhedron.png
mrpt::opengl::CSetOfLines
preview_CSetOfLines.png
mrpt::opengl::CSphere
preview_CSphere.png
mrpt::opengl::CText
preview_CText.png
mrpt::opengl::CText3D
preview_CText3D.png
mrpt::opengl::CEllipsoidRangeBearing2D
preview_CEllipsoidRangeBearing2D.png
mrpt::opengl::CEllipsoidInverseDepth2D
preview_CEllipsoidInverseDepth2D.png
mrpt::opengl::CEllipsoidInverseDepth3D
preview_CEllipsoidInverseDepth3D.png
mrpt::opengl::COctoMapVoxels
preview_COctoMapVoxels.png
mrpt::opengl::CVectorField2D
preview_CVectorField2D.png
mrpt::opengl::CVectorField3D
preview_CVectorField3D.png
mrpt::opengl::stock_objects::BumblebeeCamera()
preview_stock_objects_BumblebeeCamera.png
mrpt::opengl::stock_objects::CornerXYSimple()
preview_stock_objects_CornerXYSimple.png
mrpt::opengl::stock_objects::CornerXYZSimple()
preview_stock_objects_CornerXYZSimple.png
mrpt::opengl::stock_objects::CornerXYZ()
preview_stock_objects_CornerXYZ.png
mrpt::opengl::stock_objects::RobotPioneer()
preview_stock_objects_RobotPioneer.png
mrpt::opengl::stock_objects::RobotRhodon()
preview_stock_objects_RobotRhodon.png
mrpt::opengl::stock_objects::Hokuyo_URG()
preview_stock_objects_Hokuyo_URG.png
mrpt::opengl::stock_objects::Hokuyo_UTM()
preview_stock_objects_Hokuyo_UTM.png
mrpt::opengl::stock_objects::Househam_Sprayer()
preview_stock_objects_Househam_Sprayer.png

Also, pose PDF classes can be converted into OpenGL objects with CSetOfObjects::posePDF2opengl():

CSetOfObjects::posePDF2opengl()
for mrpt::poses::CPosePDFParticles
preview_CPosePDFParticles_as_opengl.png

Note: The following extra OpenGL classes are provided by other libraries:

mrpt::opengl::CAngularObservationMesh
(In mrpt-maps)
preview_CAngularObservationMesh.png
mrpt::opengl::CPlanarLaserScan
(In mrpt-maps)
preview_CPlanarLaserScan.png
Collaboration diagram for [mrpt-opengl]:

Classes

class  mrpt::opengl::CArrow
 A 3D arrow. More...
 
class  mrpt::opengl::CAssimpModel
 This class can load & render 3D models in a number of different formats (requires the library assimp). More...
 
class  mrpt::opengl::CAxis
 Draw a 3D world axis, with coordinate marks at some regular interval. More...
 
class  mrpt::opengl::CBox
 A solid or wireframe box in 3D, defined by 6 rectangular faces parallel to the planes X, Y and Z (note that the object can be translated and rotated afterwards as any other CRenderizable object using the "object pose" in the base class). More...
 
class  mrpt::opengl::CCamera
 A camera: if added to a scene, the viewpoint defined by this camera will be used instead of the camera parameters set in COpenGLViewport::m_camera. More...
 
class  mrpt::opengl::CColorBar
 A colorbar indicator. More...
 
class  mrpt::opengl::CCylinder
 A cylinder or cone whose base lies in the XY plane. More...
 
class  mrpt::opengl::CDisk
 A planar disk in the XY plane. More...
 
class  mrpt::opengl::CEllipsoid
 A 2D ellipse or 3D ellipsoid, depending on the size of the m_cov matrix (2x2 or 3x3). More...
 
class  mrpt::opengl::CEllipsoidInverseDepth2D
 An especial "ellipsoid" in 3D computed as the uncertainty iso-surfaces of a (inv_range,yaw) variable. More...
 
class  mrpt::opengl::CEllipsoidInverseDepth3D
 An especial "ellipsoid" in 3D computed as the uncertainty iso-surfaces of a (inv_range,yaw,pitch) variable. More...
 
class  mrpt::opengl::CEllipsoidRangeBearing2D
 An especial "ellipsoid" in 2D computed as the uncertainty iso-surfaces of a (range,bearing) variable. More...
 
class  mrpt::opengl::CFBORender
 A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext). More...
 
class  mrpt::opengl::CFrustum
 A solid or wireframe frustum in 3D (a rectangular truncated pyramid), with arbitrary (possibly assymetric) field-of-view angles. More...
 
class  mrpt::opengl::CGeneralizedCylinder
 This object represents any figure obtained by extruding any profile along a given axis. More...
 
class  mrpt::opengl::CGeneralizedEllipsoidTemplate< DIM >
 A class that generalizes the concept of an ellipsoid to arbitrary parameterizations of uncertainty shapes in either 2D or 3D. More...
 
class  mrpt::opengl::CGridPlaneXY
 A grid of lines over the XY plane. More...
 
class  mrpt::opengl::CGridPlaneXZ
 A grid of lines over the XZ plane. More...
 
class  mrpt::opengl::CMesh
 A planar (XY) grid where each cell has an associated height and, optionally, a texture map. More...
 
class  mrpt::opengl::CMesh3D
 A 3D mesh composed of Triangles and/or Quads. More...
 
class  mrpt::opengl::CMeshFast
 A planar (XY) grid where each cell has an associated height and, optionally, a texture map. More...
 
class  mrpt::opengl::COctoMapVoxels
 A flexible renderer of voxels, typically from a 3D octo map (see mrpt::maps::COctoMap). More...
 
class  mrpt::opengl::COctreePointRenderer< Derived >
 Template class that implements the data structure and algorithms for Octree-based efficient rendering. More...
 
class  mrpt::opengl::COpenGLScene
 This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives. More...
 
class  mrpt::opengl::COpenGLStandardObject
 Objects of this class represent a generic openGL object without specific geometric properties. More...
 
class  mrpt::opengl::COpenGLViewport
 A viewport within a COpenGLScene, containing a set of OpenGL objects to render. More...
 
class  mrpt::opengl::CPointCloud
 A cloud of points, all with the same color or each depending on its value along a particular coordinate axis. More...
 
class  mrpt::opengl::CPointCloudColoured
 A cloud of points, each one with an individual colour (R,G,B). More...
 
class  mrpt::opengl::CPolyhedron
 This class represents arbitrary polyhedra. More...
 
class  mrpt::opengl::CRenderizable
 The base class of 3D objects that can be directly rendered through OpenGL. More...
 
class  mrpt::opengl::CRenderizableDisplayList
 A renderizable object suitable for rendering with OpenGL's display lists. More...
 
class  mrpt::opengl::CSetOfLines
 A set of independent lines (or segments), one line with its own start and end positions (X,Y,Z). More...
 
class  mrpt::opengl::CSetOfObjects
 A set of object, which are referenced to the coordinates framework established in this object. More...
 
class  mrpt::opengl::CSetOfTexturedTriangles
 A set of textured triangles. More...
 
class  mrpt::opengl::CSetOfTriangles
 A set of colored triangles. More...
 
class  mrpt::opengl::CSimpleLine
 A line segment. More...
 
class  mrpt::opengl::CSphere
 A solid or wire-frame sphere. More...
 
class  mrpt::opengl::CText
 A 2D text (bitmap rendering): it always "faces the observer" despite it's at some 3D location. More...
 
class  mrpt::opengl::CText3D
 A 3D text (rendered with OpenGL primitives), with selectable font face and drawing style. More...
 
class  mrpt::opengl::CTextMessageCapable
 Keeps a list of text messages which can be rendered to OpenGL contexts by graphic classes. More...
 
class  mrpt::opengl::CTexturedObject
 A base class for all OpenGL objects with loadable textures. More...
 
class  mrpt::opengl::CTexturedPlane
 A 2D plane in the XY plane with a texture image. More...
 
class  mrpt::opengl::CVectorField2D
 A 2D vector field representation, consisting of points and arrows drawn on a plane (invisible grid). More...
 
class  mrpt::opengl::CVectorField3D
 A 3D vector field representation, consisting of points and arrows drawn at any spatial position. More...
 
struct  mrpt::opengl::T2DTextData
 An auxiliary struct for holding a list of text messages in some mrpt::opengl & mrpt::gui classes The font can be either a bitmapped or a vectorized font. More...
 

Namespaces

 mrpt::opengl::gl_utils
 A set of auxiliary functions that can be called to render OpenGL primitives from MRPT or user code.
 
 mrpt::opengl
 The namespace for 3D scene representation and rendering.
 
 mrpt::opengl::graph_tools
 Tool functions for graphs of pose constraints.
 
 mrpt::opengl::stock_objects
 A collection of pre-built 3D objects for quick insertion in opengl::COpenGLScene objects.
 

Enumerations

enum  mrpt::opengl::TOpenGLFont {
  mrpt::opengl::MRPT_GLUT_BITMAP_NONE = -1, mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_10 = 0, mrpt::opengl::MRPT_GLUT_BITMAP_TIMES_ROMAN_24 = 1, mrpt::opengl::MRPT_GLUT_BITMAP_HELVETICA_10 = 2,
  mrpt::opengl::MRPT_GLUT_BITMAP_HELVETICA_12 = 3, mrpt::opengl::MRPT_GLUT_BITMAP_HELVETICA_18 = 4
}
 Existing fonts for 2D texts in mrpt::opengl methods. More...
 

Functions

void mrpt::global_settings::OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL (float value)
 Default value = 0.01 points/px^2. More...
 
size_t mrpt::global_settings::OCTREE_RENDER_MAX_POINTS_PER_NODE ()
 Default value = 1e5. More...
 

Tool functions for graphs of pose constraints

template<class GRAPH_T >
CSetOfObjects::Ptr mrpt::opengl::graph_tools::graph_visualize (const GRAPH_T &g, const mrpt::system::TParametersDouble &extra_params=mrpt::system::TParametersDouble())
 Returns an opengl objects representation of an arbitrary graph, as a network of 3D pose frames. More...
 

Enumeration Type Documentation

◆ TOpenGLFont

Existing fonts for 2D texts in mrpt::opengl methods.

See also
mrpt::opengl::CWxGLCanvasBase::renderTextBitmap
Enumerator
MRPT_GLUT_BITMAP_NONE 
MRPT_GLUT_BITMAP_TIMES_ROMAN_10 
MRPT_GLUT_BITMAP_TIMES_ROMAN_24 
MRPT_GLUT_BITMAP_HELVETICA_10 
MRPT_GLUT_BITMAP_HELVETICA_12 
MRPT_GLUT_BITMAP_HELVETICA_18 

Definition at line 22 of file opengl_fonts.h.

Function Documentation

◆ graph_visualize()

template<class GRAPH_T >
CSetOfObjects::Ptr mrpt::opengl::graph_tools::graph_visualize ( const GRAPH_T &  g,
const mrpt::system::TParametersDouble extra_params = mrpt::system::TParametersDouble() 
)

Returns an opengl objects representation of an arbitrary graph, as a network of 3D pose frames.

Note that the "global" coordinates of each node are taken from mrpt::graphs::CNetworkOfPoses::nodes, so if a node appears in "edges" but not in "nodes" it will be not displayed.

Parameters
gThe graph
extra_paramsAn extra set of optional parameters (see below). List of accepted extra parameters (note that all are double values, booleans are emulated with 0 & !=0 values):
Parameter name Description Default value
show_ID_labels If set to !=0, show poses ID labels 0 (don't show)
show_ground_grid If set to !=0, create a gray grid on the ground level (mrpt::opengl::CGridPlaneXY). The extension of the grid is computed to cover the entire graph extension 1 (do show)
show_edges If set to !=0, draw lines between nodes with at least one edge between them. 1 (do show)
show_node_corners If set to !=0, draw a small 3D corner frame at each node (see mrpt::opengl::stock_objects::CornerXYZSimple). 1 (do show)
show_edge_rel_poses If set to !=0, draw the relative poses stored in each edge as a small extra 3D corner frame at each node pose (+) the edge pose (see mrpt::opengl::stock_objects::CornerXYZSimple). 1 (do show)
nodes_point_size If set to !=0, draw a point of the given size (glPointSize) at each node.

0 (no points)

nodes_corner_scale If show_node_corners!=0, the size (length) of te corner lines. 0.7
nodes_edges_corner_scale If show_edge_rel_poses is !=0, the size of the corners at the end of each drawn edge. 0.4
nodes_point_color If nodes_point_size!=0, set this value to a hexadecimal int value 0xRRGGBB with the desired RGB color of points. 0xA0A0A0 (light gray)
edge_color If show_edges is !=0, the color of those edges as a hexadecimal int value 0xAARRGGBB with Alpha+RGB color (Alpha=0xFF:opaque,0x00:transparent).

0x400000FF

edge_rel_poses_color If show_edge_rel_poses is !=0, the color of those edges as a hexadecimal int value 0xAARRGGBB with Alpha+RGB color (Alpha=0xFF:opaque,0x00:transparent). 0x40FF8000
edge_width If show_edges is !=0, the width of edge lines.

2.0

See also
mrpt::graphs::CNetworkOfPoses2D, mrpt::graphs::CNetworkOfPoses3D, mrpt::graphs::CNetworkOfPoses2DInf, mrpt::graphs::CNetworkOfPoses3DInf
Note
Implemented as headers-only in graph_tools_impl.h

Definition at line 23 of file graph_tools_impl.h.

References mrpt::opengl::stock_objects::CornerXYSimple(), mrpt::opengl::stock_objects::CornerXYZSimple(), mrpt::opengl::CSimpleLine::Create(), mrpt::opengl::CSetOfObjects::Create(), mrpt::opengl::CGridPlaneXY::Create(), mrpt::format(), mrpt::system::TParameters< T >::getWithDefaultVal(), mrpt::keep_max(), mrpt::keep_min(), MRPT_TRY_END, MRPT_TRY_START, mrpt::math::TPoint3D_data::x, mrpt::math::TPoint3D_data::y, and mrpt::math::TPoint3D_data::z.

Here is the call graph for this function:

◆ OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL()

void mrpt::global_settings::OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL ( float  value)

Default value = 0.01 points/px^2.

Affects to these classes (read their docs for further details):

Definition at line 33 of file CPointCloud.cpp.

References OCTREE_RENDER_MAX_DENSITY_POINTS_PER_SQPIXEL_value.

Referenced by mrpt::opengl::CPointCloudColoured::render_subset().

Here is the caller graph for this function:

◆ OCTREE_RENDER_MAX_POINTS_PER_NODE()

size_t mrpt::global_settings::OCTREE_RENDER_MAX_POINTS_PER_NODE ( )

Default value = 1e5.

Maximum number of elements in each octree node before spliting. Affects to these classes (read their docs for further details):

Definition at line 39 of file CPointCloud.cpp.

References OCTREE_RENDER_MAX_POINTS_PER_NODE_value.

Referenced by mrpt::opengl::COctreePointRenderer< CPointCloudColoured >::internal_recursive_split().

Here is the caller graph for this function:



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019