sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
sgltk::Framebuffer Class Reference

Manages framebuffers. More...

#include <framebuffer.h>

Public Member Functions

 Framebuffer (GLenum target=GL_FRAMEBUFFER)
GLenum get_buffer_status ()
 Checks the completeness status of the framebuffer.
void bind ()
 Binds the framebuffer to the target set in the constructor.
void bind (GLenum target)
 Binds the framebuffer to a framebuffer target.
void unbind ()
 Restores the original framebuffer as render target.
bool attach_texture (GLenum attachment, Texture &texture)
 Attaches a texture to the framebuffer.
bool attach_texture_layer (GLenum attachment, Texture &texture, unsigned int layer)
 Attaches the layer of a texture to the framebuffer.
bool attach_renderbuffer (GLenum attachment, Renderbuffer &buffer)
 Attaches a renderbuffer to the framebuffer.
void finalize ()
 Sets the draw buffers to be drawn into.
void blit_to (sgltk::Framebuffer *target, unsigned int src_x0, unsigned int src_y0, unsigned int src_x1, unsigned int src_y1, unsigned int dst_x0, unsigned int dst_y0, unsigned int dst_x1, unsigned int dst_y1, GLbitfield mask, GLenum filter)
 Copies a block of pixels from this framebuffer to another one.
void blit_from_default (unsigned int src_x0, unsigned int src_y0, unsigned int src_x1, unsigned int src_y1, unsigned int dst_x0, unsigned int dst_y0, unsigned int dst_x1, unsigned int dst_y1, GLbitfield mask, GLenum filter)
 Copies a block of pixels from the default framebuffer to this one.

Detailed Description

Manages framebuffers.

Definition at line 14 of file framebuffer.h.

Constructor & Destructor Documentation

◆ Framebuffer()

Framebuffer::Framebuffer ( GLenum target = GL_FRAMEBUFFER)
Parameters
targetThe target of the future binding operations

Definition at line 7 of file framebuffer.cpp.

◆ ~Framebuffer()

Framebuffer::~Framebuffer ( )

Definition at line 17 of file framebuffer.cpp.

Member Function Documentation

◆ attach_renderbuffer()

bool Framebuffer::attach_renderbuffer ( GLenum attachment,
Renderbuffer & buffer )

Attaches a renderbuffer to the framebuffer.

Parameters
attachmentThe attachment point to which the renderbuffer is attached
bufferThe renderbuffer to attach
Returns
Returns true on success, false otherwise

Definition at line 121 of file framebuffer.cpp.

◆ attach_texture()

bool Framebuffer::attach_texture ( GLenum attachment,
Texture & texture )

Attaches a texture to the framebuffer.

Parameters
attachmentThe attachment point to which the texture is attached
textureThe texture to attach
Returns
Returns true on success, false otherwise

Definition at line 45 of file framebuffer.cpp.

◆ attach_texture_layer()

bool Framebuffer::attach_texture_layer ( GLenum attachment,
Texture & texture,
unsigned int layer )

Attaches the layer of a texture to the framebuffer.

Parameters
attachmentThe attachment point to which the texture layer is attached
textureThe texture containing the layer to attach
layerThe layer to attach
Returns
Returns true on success, false otherwise

Definition at line 80 of file framebuffer.cpp.

◆ bind() [1/2]

void Framebuffer::bind ( )

Binds the framebuffer to the target set in the constructor.

Definition at line 28 of file framebuffer.cpp.

◆ bind() [2/2]

void Framebuffer::bind ( GLenum target)

Binds the framebuffer to a framebuffer target.

Parameters
targetThe target of the binding operation

Definition at line 32 of file framebuffer.cpp.

◆ blit_from_default()

void Framebuffer::blit_from_default ( unsigned int src_x0,
unsigned int src_y0,
unsigned int src_x1,
unsigned int src_y1,
unsigned int dst_x0,
unsigned int dst_y0,
unsigned int dst_x1,
unsigned int dst_y1,
GLbitfield mask,
GLenum filter )

Copies a block of pixels from the default framebuffer to this one.

Parameters
src_x0,src_y0,src_x1,src_y1The bounds of the source rectangle within the default framebuffer
dst_x0,dst_y0,dst_x1,dst_y1The bounds of the destination rectangle
maskThe bitwise OR of the flags indicating which buffers are to be copied. The allowed flags are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT and GL_STENCIL_BUFFER_BIT.
filterThe interpolation to be applied if the image is stretched. Must be GL_NEAREST or GL_LINEAR.

Definition at line 194 of file framebuffer.cpp.

◆ blit_to()

void Framebuffer::blit_to ( sgltk::Framebuffer * target,
unsigned int src_x0,
unsigned int src_y0,
unsigned int src_x1,
unsigned int src_y1,
unsigned int dst_x0,
unsigned int dst_y0,
unsigned int dst_x1,
unsigned int dst_y1,
GLbitfield mask,
GLenum filter )

Copies a block of pixels from this framebuffer to another one.

Parameters
targetThe framebuffer to copy to. A null pointer indicates the default framebuffer
src_x0,src_y0,src_x1,src_y1The bounds of the source rectangle within the default framebuffer
dst_x0,dst_y0,dst_x1,dst_y1The bounds of the destination rectangle
maskThe bitwise OR of the flags indicating which buffers are to be copied. The allowed flags are GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT and GL_STENCIL_BUFFER_BIT.
filterThe interpolation to be applied if the image is stretched. Must be GL_NEAREST or GL_LINEAR.

Definition at line 169 of file framebuffer.cpp.

◆ finalize()

void Framebuffer::finalize ( )

Sets the draw buffers to be drawn into.

Definition at line 159 of file framebuffer.cpp.

◆ get_buffer_status()

GLenum Framebuffer::get_buffer_status ( )

Checks the completeness status of the framebuffer.

Returns
Returns the status of the framebuffer

Definition at line 21 of file framebuffer.cpp.

◆ unbind()

void Framebuffer::unbind ( )

Restores the original framebuffer as render target.

Definition at line 41 of file framebuffer.cpp.


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