Gorgon Game Engine
FrameBuffer Class Reference

This is a frame buffer object that can be used for render to texture tasks. More...

Public Member Functions

 FrameBuffer ()
 Does not perform any action, allows late generation of buffers. More...
 
 FrameBuffer (bool depth)
 Generates a frame buffer. More...
 
 FrameBuffer (const FrameBuffer &)=delete
 
 ~FrameBuffer ()
 
void Destroy ()
 Destroys the frame buffer. More...
 
void Generate (bool depth)
 Generates a frame buffer. More...
 
Texture GetTexture () const
 Returns the texture of this buffer. More...
 
bool IsFunctional () const
 Returns if the frame buffer is fully functional. More...
 
bool IsReady () const
 Returns if the frame buffer ready. More...
 
FrameBufferoperator= (const FrameBuffer &)=delete
 
void RenderToScreen ()
 Stop using this buffer and render to screen instead. More...
 
void Use ()
 Begin using this frame buffer. More...
 

Static Public Member Functions

static void UpdateSizes ()
 Updates the size of all framebuffers. More...
 

Static Public Attributes

static bool HardwareSupport
 Whether hardware supports frame buffers. More...
 

Detailed Description

This is a frame buffer object that can be used for render to texture tasks.

This object cannot be copied.

Constructor & Destructor Documentation

◆ FrameBuffer() [1/3]

FrameBuffer ( const FrameBuffer )
delete

◆ FrameBuffer() [2/3]

Does not perform any action, allows late generation of buffers.

◆ FrameBuffer() [3/3]

FrameBuffer ( bool  depth)
explicit

Generates a frame buffer.

If software frame buffer does not work, this will create only a texture. Use UpdateTexture to update the texture. See Generate.

References FrameBuffer::Generate().

◆ ~FrameBuffer()

Member Function Documentation

◆ Destroy()

void Destroy ( )

Destroys the frame buffer.

References Gorgon::GL::DestroyTexture(), glDeleteFramebuffers, and glDeleteRenderbuffers.

◆ Generate()

void Generate ( bool  depth)

Generates a frame buffer.

If software frame buffer does not work, this will create only a texture. Use UpdateTexture to update the texture. This function will cause the system to switch to render to screen.

References Gorgon::GL::GenerateEmptyTexture(), Window::GetMinimumRequiredSize(), glBindFramebuffer, glBindRenderbuffer, glDrawBuffers, glFramebufferRenderbuffer, glFramebufferTexture2D, glGenFramebuffers, glGenRenderbuffers, glRenderbufferStorage, Gorgon::GL::log, and Gorgon::Graphics::RGBA.

◆ GetTexture()

Texture GetTexture ( ) const

Returns the texture of this buffer.

◆ IsFunctional()

bool IsFunctional ( ) const

Returns if the frame buffer is fully functional.

References glBindFramebuffer.

◆ IsReady()

bool IsReady ( ) const

Returns if the frame buffer ready.

◆ operator=()

FrameBuffer& operator= ( const FrameBuffer )
delete

◆ RenderToScreen()

void RenderToScreen ( )

Stop using this buffer and render to screen instead.

References Gorgon::GL::RenderToScreen().

◆ UpdateSizes()

void UpdateSizes ( )
static

◆ Use()

void Use ( )

Begin using this frame buffer.

References glBindFramebuffer.

Member Data Documentation

◆ HardwareSupport

bool HardwareSupport
static

Whether hardware supports frame buffers.

If it does not, using frame buffer has no effect. However, frame buffer will generate a screen sized texture keeping it updated with the screen resolution. Thus, even if operation is performed on software, it is still a good idea to use FrameBuffer class


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