nCine::RHI::GL::GLRenderTarget class

Off-screen render target of the OpenGL backend.

Folds a framebuffer object and its owned depth/stencil renderbuffer behind a backend-neutral surface (aliased as RHI::RenderTarget): color attachments are textures addressed by index, the depth/stencil attachment is described by DepthStencilFormat, and the backend translates both to its own attachment points and storage formats.

Public static functions

static void UnbindDraw()
Unbinds any render target from drawing, restoring the default one.

Constructors, destructors, conversion operators

GLRenderTarget() defaulted
GLRenderTarget(const GLRenderTarget&) deleted

Public functions

auto operator=(const GLRenderTarget&) -> GLRenderTarget& deleted
void AttachColorTexture(GLTexture& texture, std::uint32_t index)
Attaches a texture as the color attachment with the given index.
void DetachColorTexture(std::uint32_t index)
Detaches any texture from the color attachment with the given index.
void AttachDepthStencil(DepthStencilFormat format, std::int32_t width, std::int32_t height)
Creates and attaches a depth/stencil buffer of the given format and size.
void DetachDepthStencil(DepthStencilFormat format)
Detaches and destroys the depth/stencil buffer of the given format.
void BindDraw()
Binds the render target for drawing.
auto SetDrawBuffers(std::uint32_t numColorAttachments) -> bool
Sets the number of color attachments enabled for drawing.
auto IsStatusComplete() -> bool
Returns true if the render target is complete and ready for rendering.
void InvalidateDepthStencil(DepthStencilFormat format)
Hints that the contents of the depth/stencil attachment are no longer needed.
void SetObjectLabel(StringView label)
Sets a backend object label for the render target, for debugging.