Shader Tool
Small shader visualiser.
st::Framebuffer Class Reference

Used to render the scene to a framebuffer and apply post processig shaders to it. More...

#include <Framebuffer.hpp>

Public Member Functions

 Framebuffer ()=default
 
 Framebuffer (std::shared_ptr< ShaderProgram > shader)
 Creates a Framebuffer. More...
 
void render (int x, int y, int width, int height)
 Renders the framebuffer in the specified screen dymensions. More...
 
void setFramebuffer ()
 Inits the glViewport and the GL_FRAMEBUFFER for the scene objects to be rendered. More...
 

Private Attributes

std::shared_ptr< ShaderProgramshader
 Post processing shader. More...
 
GLuint framebuffer_id
 
GLuint depthbuffer_id
 
GLuint out_texture_id
 
GLuint triangle_vbo0
 
GLuint triangle_vbo1
 

Static Private Attributes

static const GLsizei framebuffer_width = 2048
 The resolution in wich the scene is going to be rendered in the framebuffer. More...
 
static const GLsizei framebuffer_height = 2048
 

Detailed Description

Used to render the scene to a framebuffer and apply post processig shaders to it.

Constructor & Destructor Documentation

◆ Framebuffer() [1/2]

st::Framebuffer::Framebuffer ( )
default

◆ Framebuffer() [2/2]

st::Framebuffer::Framebuffer ( std::shared_ptr< ShaderProgram shader)

Creates a Framebuffer.

Creation of the GL_FRAMEBUFFER, texture, z-buffer and the screen quad.

Parameters
postprocessing shader that will be used to render the framebuffer.
  • check for an error during the load process */

Member Function Documentation

◆ render()

void st::Framebuffer::render ( int  x,
int  y,
int  width,
int  height 
)

Renders the framebuffer in the specified screen dymensions.

The framebuffer needs to be set before calling to render. To be called after rendering all other scene elements.

Parameters
widthscreen width.
heightscreen height.

◆ setFramebuffer()

void st::Framebuffer::setFramebuffer ( )

Inits the glViewport and the GL_FRAMEBUFFER for the scene objects to be rendered.

To be called at the start of the scene rendering.

Member Data Documentation

◆ depthbuffer_id

GLuint st::Framebuffer::depthbuffer_id
private

◆ framebuffer_height

const GLsizei st::Framebuffer::framebuffer_height = 2048
staticprivate

◆ framebuffer_id

GLuint st::Framebuffer::framebuffer_id
private

◆ framebuffer_width

const GLsizei st::Framebuffer::framebuffer_width = 2048
staticprivate

The resolution in wich the scene is going to be rendered in the framebuffer.

◆ out_texture_id

GLuint st::Framebuffer::out_texture_id
private

◆ shader

std::shared_ptr< ShaderProgram > st::Framebuffer::shader
private

Post processing shader.

◆ triangle_vbo0

GLuint st::Framebuffer::triangle_vbo0
private

◆ triangle_vbo1

GLuint st::Framebuffer::triangle_vbo1
private

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