[mrpt-opengl]

Overview

Low-level GPU rendering: shaders, textures, framebuffers, and the rendering pipeline that draws mrpt::viz scenes.

Library mrpt-opengl

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

sudo apt install libmrpt-opengl-dev

Read also how to import MRPT into your CMake scripts.

MRPT 3.0 namespace split

In MRPT 3.0 the scene-graph API (3-D objects, scenes, viewports, cameras, stock objects) moved from mrpt::opengl to mrpt::viz (library mrpt-viz). See lib_mrpt_viz_grp for the scene-graph documentation and the full list of rendering primitives.

What remains in mrpt::opengl is the low-level GPU rendering backend:

User code that builds 3-D scenes should depend on mrpt_viz, not on mrpt_opengl directly. Only code that performs custom GPU rendering (e.g., off-screen rendering with CFBORender) needs mrpt_opengl.

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

Library contents

// typedefs

typedef uint8_t mrpt::opengl::shader_id_t;

// structs

struct mrpt::opengl::CompilationStats;
struct mrpt::opengl::FrameBufferBinding;
struct mrpt::opengl::RenderContext;
struct mrpt::opengl::RenderQueue;
struct mrpt::opengl::RenderQueueElement;
struct mrpt::viz::T2DTextData;
struct mrpt::opengl::TRenderMatrices;
struct mrpt::opengl::ViewportRenderStats;
struct mrpt::opengl::texture_name_unit_t;

// classes

class mrpt::opengl::Buffer;
class mrpt::opengl::CFBORender;
class mrpt::opengl::CompiledScene;
class mrpt::opengl::CompiledViewport;
class mrpt::opengl::FrameBuffer;
class mrpt::opengl::LinesProxy;
class mrpt::opengl::LinesProxyBase;

template <int DEPTH_LUT_NUM_BITS = 18>
class mrpt::opengl::OpenGLDepth2LinearLUTs;

class mrpt::opengl::PointsProxy;
class mrpt::opengl::PointsProxyBase;
class mrpt::opengl::Program;
class mrpt::opengl::RenderableProxy;
class mrpt::opengl::Shader;
class mrpt::opengl::ShaderProgramManager;
class mrpt::opengl::SkyBoxProxy;
class mrpt::opengl::Texture;
class mrpt::opengl::TexturedTrianglesProxy;
class mrpt::opengl::TexturedTrianglesProxyBase;
class mrpt::opengl::TrianglesProxy;
class mrpt::opengl::TrianglesProxyBase;
class mrpt::opengl::VertexArrayObject;

// global functions

Program::Ptr mrpt::opengl::LoadDefaultShader(shader_id_t id);
void mrpt::opengl::registerAllClasses_mrpt_opengl();
bool mrpt::opengl::boxIntersectsClipVolume(const mrpt::math::TBoundingBoxf& bb, const mrpt::math::CMatrixFloat44& clipFromLocal, unsigned int planes = 0x3F);
std::unique_ptr<ShaderProgramManager> mrpt::opengl::createAndPreloadShaders();

Typedefs

typedef uint8_t mrpt::opengl::shader_id_t

Type for IDs of shaders.

See also:

DefaultShaderID, LoadDefaultShader()

Global Functions

Program::Ptr mrpt::opengl::LoadDefaultShader(shader_id_t id)

Loads a set of OpenGL Vertex+Fragment shaders from the default library available in mrpt::opengl.

See also:

CRenderizable

void mrpt::opengl::registerAllClasses_mrpt_opengl()

Forces manual RTTI registration of all serializable classes in this namespace.

Should never be required to be explicitly called by users, except if building MRPT as a static library.

bool mrpt::opengl::boxIntersectsClipVolume(
    const mrpt::math::TBoundingBoxf& bb,
    const mrpt::math::CMatrixFloat44& clipFromLocal,
    unsigned int planes = 0x3F
    )

Conservative culling test: returns false only if the local axis-aligned box bb, transformed by clipFromLocal (e.g.

P*V*M), lies entirely outside one of the clip volume planes. Valid for perspective and orthographic projections alike. Bits of planes select which planes to test: 1=left, 2=right, 4=bottom, 8=top, 16=near, 32=far.

std::unique_ptr<ShaderProgramManager> mrpt::opengl::createAndPreloadShaders()

Helper: Creates a shader program manager and preloads all default shaders.

Convenience function for initialization. Logs any compilation errors to stderr.

Example:

auto shaderMgr = createAndPreloadShaders();
// All default shaders are now ready to use

Returns:

Unique pointer to initialized manager