class mrpt::opengl::FrameBuffer

Overview

An OpenGL FrameBuffer resource (FBO) with either RGBA+depth or depth only render buffers.

Refer to docs for glGenFramebuffers() and glGenRenderbuffers().

See also:

Buffer, DepthMapFBO

#include <mrpt/opengl/FrameBuffer.h>

class FrameBuffer
{
public:
    // structs

    struct RAII_Impl;

    // construction

    FrameBuffer();

    // methods

    void create(unsigned int width, unsigned int height, int nSamples = 1);
    void createDepthMap(unsigned int width, unsigned int height);
    void destroy();
    FrameBufferBinding bind();
    void unbind();
    void blit();
    bool initialized() const;
    unsigned int width() const;
    unsigned int height() const;
    int numSamples() const;
    unsigned int depthMapTextureId() const;
    static void Bind(const FrameBufferBinding& ids);
    static void Unbind();
    static FrameBufferBinding CurrentBinding();
};

Methods

void create(unsigned int width, unsigned int height, int nSamples = 1)

Creates a new FB object and the two (RGBA+depth) render buffers.

void createDepthMap(unsigned int width, unsigned int height)

Creates a new depth-only FBO.

void destroy()

Release resources.

FrameBufferBinding bind()

Bind this framebuffer object to the current context.

Returns:

The former binding

See also:

Bind(), CurrentBinding()

void unbind()

Unbind the framebuffer object from the context.

void blit()

Blit the framebuffer object onto the screen.

static void Unbind()

Calls glBindFramebuffer(GL_FRAMEBUFFER, 0);.