class mrpt::opengl::CFBORender

A class for rendering 3D scenes off-screen directly into an image using OpenGL extensions (glext).

To define a background color, set it in the scene’s “main” viewport.

You can add overlaid text messages, see base class CTextMessageCapable

See also:

Example Example: opengl_offscreen_render_example

#include <mrpt/opengl/CFBORender.h>

class CFBORender
{
public:
    // construction

    CFBORender(
        unsigned int width = 800,
        unsigned int height = 600,
        const bool skip_glut_window = false
        );

    //
methods

    void setCamera(const COpenGLScene& scene, const CCamera& camera);
    CCamera& getCamera(const COpenGLScene& scene);
    void getFrame(const COpenGLScene& scene, mrpt::img::CImage& image);
    void getFrame2(const COpenGLScene& scene, mrpt::img::CImage& image);
    void resize(unsigned int width, unsigned int height);
    const mrpt::img::TColorf& getBackgroundColor() const;
    void setBackgroundColor(const mrpt::img::TColorf& col);
};

Construction

CFBORender(
    unsigned int width = 800,
    unsigned int height = 600,
    const bool skip_glut_window = false
    )

Constructor.

Parameters:

skip_glut_window

Should be set to true only if another GUI windows already exist with an associated OpenGL context. If left to false, a hidden GLUT window will be created.

Methods

void setCamera(const COpenGLScene& scene, const CCamera& camera)

Change the scene camera.

CCamera& getCamera(const COpenGLScene& scene)

Get a reference to the scene camera.

void getFrame(const COpenGLScene& scene, mrpt::img::CImage& image)

Render the scene and get the rendered rgb image.

Resizes the image buffer if it is necessary.

void getFrame2(const COpenGLScene& scene, mrpt::img::CImage& image)

Render the scene and get the rendered rgb image.

Does not resize the image buffer.

void resize(unsigned int width, unsigned int height)

Resize the rendering canvas size.

const mrpt::img::TColorf& getBackgroundColor() const

Get the default background color (unles an COpenGLViewport defines a custom color)

void setBackgroundColor(const mrpt::img::TColorf& col)

Set the default background color (unles an COpenGLViewport defines a custom color)