class mrpt::opengl::CRenderizable

The base class of 3D objects that can be directly rendered through OpenGL.

In this class there are a set of common properties to all 3D objects, mainly:

  • Its SE(3) pose (x,y,z,yaw,pitch,roll), relative to the parent object, or the global frame of reference for root objects (inserted into a mrpt::opengl::COpenGLScene).

  • A name: A name that can be optionally asigned to objects for easing its reference.

  • A RGBA color: This field will be used in simple elements (points, lines, text,…) but is ignored in more complex objects that carry their own color information (triangle sets,…)

See the main class opengl::COpenGLScene

See also:

opengl::COpenGLScene, mrpt::opengl

#include <mrpt/opengl/CRenderizable.h>

class CRenderizable: public mrpt::serialization::CSerializable
{
public:
    // structs

    struct RenderContext;
    struct State;

    // construction

    CRenderizable();

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual shader_list_t requiredShaders() const;
    virtual void freeOpenGLResources() = 0;
};

// direct descendants

class CCamera;
class CEllipsoidInverseDepth3D;
class CEllipsoidRangeBearing2D;
class CRenderizableShaderPoints;
class CRenderizableShaderText;
class CRenderizableShaderTexturedTriangles;
class CRenderizableShaderTriangles;
class CRenderizableShaderWireFrame;
class CSetOfObjects;

Construction

CRenderizable()

Default constructor:

Methods

virtual void render(const RenderContext& rc) const = 0

Implements the rendering of 3D objects in each class derived from CRenderizable.

This can be called more than once (one per required shader program) if the object registered several shaders.

See also:

renderUpdateBuffers

virtual void renderUpdateBuffers() const = 0

Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers, etc.

before they are sent for rendering in render()

virtual shader_list_t requiredShaders() const

Returns the ID of the OpenGL shader program required to render this class.

See also:

DefaultShaderID

virtual void freeOpenGLResources() = 0

Free opengl buffers.