class glw::FrameBuffer — HIRO 0.7.0 documentation

# class glw::FrameBuffer

## Overview

Class used to store buffers for internal rendering. More…

    #include <FrameBuffer.h>

    class FrameBuffer {
    public:
        // enums

        enum DepthBufferType;

        // structs

        struct Settings;

        // construction

        FrameBuffer(const FrameBuffer::Settings& settings);
        ~FrameBuffer();

        // methods

        static PFrameBuffer Create(const FrameBuffer::Settings& settings);
        static bool TestMaxColorAttachments(int32_t color_att_count);
        static bool TestOpenGLVersion();
        bool IsGood() const;
        const FrameBuffer::Settings& GetSettings() const;
        void Bind() const;
        void Unbind() const;
        size_t GetTextureCount() const;
        PTexture GetTexture(size_t texture_id = 0) const;
        PTexture2D GetTexture2D(size_t texture_id = 0) const;
        PTexture GetDepthTexture() const;
        PTexture2D GetDepthTexture2D() const;
        void BindTextures() const;
        glm::uvec2 GetResolution() const;
        uint32_t GetWidth() const;
        uint32_t GetHeight() const;
        gl::GLuint GetId() const;
        bool CopyTo(const PFrameBuffer& dest) const;
        PFrameBuffer Clone() const;
    };

## Detailed Documentation

Class used to store buffers for internal rendering.

### Construction

    FrameBuffer(const FrameBuffer::Settings& settings)

Creates object. Needs to be initialized before use.

    ~FrameBuffer()

Destroys object and allocated resources.

### Methods

    static PFrameBuffer Create(const FrameBuffer::Settings& settings)

Creates initialized FrameBuffer object. Returns nullptr when OpenGL version is not sufficient.

Parameters:

settings | Settings used for FrameBuffer initialization.

    static bool TestMaxColorAttachments(int32_t color_att_count)

Test whether number of color attachments satisfies the system limit.

    static bool TestOpenGLVersion()

Test whether system OpenGL version is sufficient for FrameBuffer usage.

    void Bind() const

Binds this FrameBuffer object.

    void Unbind() const

Binds default FrameBuffer.

    size_t GetTextureCount() const

Returns number of color attachments.

    PTexture GetTexture(size_t texture_id = 0) const

Returns color attachment texture object.

    PTexture2D GetTexture2D(size_t texture_id = 0) const

Returns 2D color attachment texture object. If initialized to use multiple samples, returns nullptr.

    PTexture GetDepthTexture() const

Return depth attachment texture object.

    PTexture2D GetDepthTexture2D() const

Return 2D depth attachment texture object.

    void BindTextures() const

Binds all attached textures to different texture units in order.

    glm::uvec2 GetResolution() const

Returns resolution frame buffer. Samples are not included.

    uint32_t GetWidth() const

Returns horizontal resolution of frame buffer. Samples are not included.

    uint32_t GetHeight() const

Returns vertical resolution of frame buffer. Samples are not included.

    gl::GLuint GetId() const

Returns OpenGL name of frame buffer.

    bool CopyTo(const PFrameBuffer& dest) const

Copies data from this FrameBuffer to the passed. Returns true if copy was successful.

    PFrameBuffer Clone() const

Copies data from this FrameBuffer to the passed. Returns true if copy was successful.