Class renderbuffer

Class Documentation

class legion::rendering::renderbuffer

Low level renderbuffer.

Public Functions

renderbuffer() = default

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

renderbuffer(GLenum internalformat, math::ivec2 resolution, uint samples = 0)

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

Note

Read more at docs.gl.

Parameters
  • internalformat: Internal format of the renderbuffer. eg: GL_DEPTH_COMPONENT, GL_DEPTH24_STENCIL8, GL_STENCIL_INDEX

  • resolution: Resolution of the renderbuffer.

  • samples: Amount of samples to use for multi-sampling. Leave this 0 to disable multi-sampling.

renderbuffer(GLenum internalformat, int width, int height, uint samples = 0)

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

Note

Read more at docs.gl.

Parameters
  • internalformat: Internal format of the renderbuffer. eg: GL_DEPTH_COMPONENT, GL_DEPTH24_STENCIL8, GL_STENCIL_INDEX

  • width: Width of the renderbuffer.

  • height: Height of the renderbuffer.

  • samples: Amount of samples to use for multi-sampling. Leave this 0 to disable multi-sampling.

renderbuffer(GLenum internalformat, uint samples = 0)

Main non allocating constructor. This constructor actually creates the GPU side renderbuffer.

Note

Read more at docs.gl.

Note

This constructor doesn’t actually allocate any VRAM to this renderbuffer yet and requires a resize call in order to allocate memory for it.

Parameters
  • internalformat: Internal format of the renderbuffer. eg: GL_DEPTH_COMPONENT, GL_DEPTH24_STENCIL8, GL_STENCIL_INDEX

  • samples: Amount of samples to use for multi-sampling. Leave this 0 to disable multi-sampling.

void bind() const

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

app::gl_id id() const

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

size_type samples() const

Returns the multi-sampling sample count of the renderbuffer. Useful for low level native rendering.

GLenum format() const

Returns the internal format of the renderbuffer. Useful for low level native rendering.

math::ivec2 size() const

Returns the current resolution of the renderbuffer.

void resize(math::ivec2 newSize) const

Resizes the renderbuffer to a new resolution. This reallocates VRAM and thus invalidates all data in the renderbuffer.

Public Static Functions

static void release()

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