GLW
Computer Graphics Structures library
glw::FrameBuffer Class Reference

Class used to store buffers for internal rendering. More...

Data Structures

struct  Settings
 Settings defining frame buffer properties. More...
 

Public Types

enum  DepthBufferType { DepthBufferType::none = 0, DepthBufferType::hidden = 1, DepthBufferType::texture = 2 }
 Possible depth buffer types. More...
 

Public Member Functions

 FrameBuffer (const FrameBuffer::Settings &settings)
 Creates object. Needs to be initialized before use.
 
 ~FrameBuffer ()
 Destroys object and allocated resources.
 
bool IsGood () const
 
const FrameBuffer::Settings & GetSettings () const
 
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.
 

Static Public Member Functions

static PFrameBuffer Create (const FrameBuffer::Settings &settings)
 Creates initialized FrameBuffer object. Returns nullptr when OpenGL version is not sufficient. More...
 
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.
 

Detailed Description

Class used to store buffers for internal rendering.

Member Enumeration Documentation

◆ DepthBufferType

Possible depth buffer types.

Enumerator
none 

No depth buffer.

hidden 

Hidden depth buffer using render buffer.

texture 

Accessible depth buffer using texture object.

Member Function Documentation

◆ Create()

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

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

Parameters
settingsSettings used for FrameBuffer initialization.