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:

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

  • 6D coordinates (x,y,z,yaw,pitch,roll), relative to the “current” reference framework. By default, any object is referenced to global scene coordinates.

  • A RGB 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;

    // construction

    CRenderizable();

    //
methods

    virtual void render(const RenderContext& rc) const = 0;
    virtual void renderUpdateBuffers() const = 0;
    virtual shader_list_t requiredShaders() const;
    virtual auto getBoundingBox() const = 0;
    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 auto getBoundingBox() const = 0

Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent.

virtual void freeOpenGLResources() = 0

Free opengl buffers.