libdonut  2.3.2
Application framework for cross-platform game development in C++20
Classes | Public Member Functions | List of all members
donut::graphics::Framebuffer Class Reference

Unique resource handle with exclusive ownership of a GPU framebuffer. More...

#include <donut/graphics/Framebuffer.hpp>

Classes

class  TextureAttachment
 Scope guard type representing an active texture attachment to a framebuffer that automatically detaches itself when destroyed. More...
 

Public Member Functions

 Framebuffer ()
 Create a new GPU framebuffer resource. More...
 
TextureAttachment attachTexture2D (Texture &texture)
 Attach a 2D texture to the color attachment of the framebuffer for drawing to. More...
 
Handle get () const noexcept
 Get an opaque handle to the GPU representation of the framebuffer. More...
 

Detailed Description

Unique resource handle with exclusive ownership of a GPU framebuffer.

Examples
example_game.cpp, and example_rectangle.cpp.

Constructor & Destructor Documentation

◆ Framebuffer()

donut::graphics::Framebuffer::Framebuffer ( )

Create a new GPU framebuffer resource.

Exceptions
graphics::Erroron failure to create the framebuffer object.

Member Function Documentation

◆ attachTexture2D()

TextureAttachment donut::graphics::Framebuffer::attachTexture2D ( Texture texture)
inline

Attach a 2D texture to the color attachment of the framebuffer for drawing to.

Parameters
texturethe texture to attach. Must be a valid 2D texture with a framebuffer-compatible internal format, size and options. Otherwise, the behavior is unspecified.
Returns
a scope guard representing the texture attachment. The attachment ends when the guard object is destroyed.

◆ get()

Handle donut::graphics::Framebuffer::get ( ) const
inlinenoexcept

Get an opaque handle to the GPU representation of the framebuffer.

Returns
a non-owning resource handle to the GPU representation of the framebuffer.
Note
This function is used internally by the implementations of various abstractions and is not intended to be used outside of the graphics module. The returned handle has no meaning to application code.

The documentation for this class was generated from the following file: