Class framebuffer

Class Documentation

class legion::rendering::framebuffer

Low level framebuffer.

Public Functions

framebuffer() = default

Faux constructor. To prevent unnecessary GPU allocations the default constructor doesn’t actually create a framebuffer. This means that default initialized framebuffers are invalid temporary objects until they get properly initialized.

explicit framebuffer(GLenum target)

Main allocating constructor. This constructor actually creates the GPU side framebuffer.

Note

Read more at docs.gl.

Parameters
  • target: Framebuffer target for general operations.

std::pair<bool, std::string> verify() const

Check if the framebuffer is valid and complete.

Return

std::pair<bool, std::string> First will be a boolean that will be true if the framebuffer is valid, the second will be the message about the state of the framebuffer.

GLenum target() const

Returns the rendering API type/target of the framebuffer. Useful for low level native rendering.

app::gl_id id() const

Returns the rendering API id of the framebuffer. Useful for low level native rendering.

void bind() const

Bind the framebuffer to the current context. Useful for low level native rendering.

void attach(renderbuffer rbo, GLenum attachment)

Attach a renderbuffer to a certain attachment-point of this framebuffer.

Parameters
  • rbo: Renderbuffer to attach.

  • attachment: Attachment-point to attach the renderbuffer to.

void attach(attachment att, GLenum attachment)

Attach a unknown type attachment to a certain attachment-point of this framebuffer.

Parameters
  • any: Attachment to attach.

  • attachment: Attachment-point to attach the renderbuffer to.

void attach(texture_handle texture, GLenum attachment)

Attach a texture to a certain attachment-point of this framebuffer.

Parameters
  • texture: Texture handle of the texture to attach.

  • attachment: Attachment-point to attach the texture to.

void detach(GLenum attachment)
const attachment &getAttachment(GLenum attachment) const

Get the attachment of a certain attachment-point.

Return

const std::any& An std::any that should be any_castable to either a texture handle or a renderbuffer if an attachment was active, the std::any will be empty otherwise.

Parameters
  • attachment: Attachment-point to fetch the attachment for.

void release() const

Release the framebuffer from the current context. Useful for low level native rendering.

operator bool() const

Check if the framebuffer was generated or not.