Basic Renderer
|
A custom framebuffer object allows to draw to non-default framebuffer locations and offers the possibility to attach textures. More...
#include <Framebuffer.h>
Public Member Functions | |
Framebuffer () | |
Constructor that takes care of the resolution automatically. More... | |
Framebuffer (GLint width, GLint height) | |
Constructor with fixed resolution. More... | |
virtual | ~Framebuffer () |
Virtual destructor. More... | |
virtual void | bind (bool preserveCurrentFramebuffer) |
Bind the framebuffer object. More... | |
virtual void | bindTexture (TexturePtr texture, bool preserveCurrentFramebuffer) |
Bind the framebuffer object and draw to the specified texture. More... | |
virtual void | bindCubeMap (CubeMapPtr cubeMap, GLuint cubeFace, bool preserveCurrentFramebuffer) |
Bind the framebuffer object and draw to the specified cube map. More... | |
virtual void | bindDepthMap (DepthMapPtr depthMap, bool preserveCurrentFramebuffer) |
Bind the framebuffer object and draw to the specified depth map. More... | |
virtual void | unbind () |
Unbind the framebuffer object. More... | |
virtual void | unbind (GLint fbo) |
Unbind the framebuffer object and bind the specified framebuffer object. More... | |
virtual void | resize (GLint width, GLint height, bool autoResize) |
Updates the size of the framebuffer. More... | |
GLuint | getFramebufferID () |
Get the framebuffer id. More... | |
GLuint | getDebthbufferID () |
Get the depthbuffer id. More... | |
GLint | getWidth () |
Get the width of the framebuffer. More... | |
GLint | getHeight () |
Get the height of the framebuffer. More... | |
virtual void | deleteFramebuffer () |
Delete the framebuffer. More... | |
Static Public Member Functions | |
static GLint | getCurrentFramebuffer () |
Get the framebuffer currently active. More... | |
A custom framebuffer object allows to draw to non-default framebuffer locations and offers the possibility to attach textures.
Framebuffer::Framebuffer | ( | ) |
Constructor that takes care of the resolution automatically.
Framebuffer::Framebuffer | ( | GLint | width, |
GLint | height | ||
) |
Constructor with fixed resolution.
[in] | width | |
[in] | height |
|
inlinevirtual |
Virtual destructor.
|
virtual |
Bind the framebuffer object.
[in] | preserveCurrentFramebuffer | If true the framebuffer that was active before binding is bound again when unbinding |
|
virtual |
Bind the framebuffer object and draw to the specified cube map.
[in] | cubeMap | The cube map to draw to |
[in] | cubeFace | Defines which face to bind: 0 = left, 1 = right, 2 = bottom, 3 = top, 4= front, 5 = back |
[in] | preserveCurrentFramebuffer | If true the framebuffer that was active before binding is bound again when unbinding |
|
virtual |
Bind the framebuffer object and draw to the specified depth map.
[in] | depthMap | The depth map to draw to |
[in] | preserveCurrentFramebuffer | If true the framebuffer that was active before binding is bound again when unbinding |
|
virtual |
Bind the framebuffer object and draw to the specified texture.
[in] | texture | The texture to draw to |
[in] | preserveCurrentFramebuffer | If true the framebuffer that was active before binding is bound again when unbinding |
Hint: Not all textures work, especially when changing resolution between frames. It's best to not use mip mapping. A suitable texture can be generated using Renderer::createTexture and not passing any data (GLenum format = GL_RGBA, ImageDataPtr imageData = nullptr) Do NOT use a cube map in this function!
|
virtual |
Delete the framebuffer.
|
static |
Get the framebuffer currently active.
|
inline |
Get the depthbuffer id.
|
inline |
Get the framebuffer id.
|
inline |
Get the height of the framebuffer.
|
inline |
Get the width of the framebuffer.
|
virtual |
Updates the size of the framebuffer.
[in] | width | |
[in] | height | |
[in] | autoResize | Set true if the size should be reset to the viewport size automatically the next time the fbo is bound |
|
virtual |
Unbind the framebuffer object.
|
virtual |
Unbind the framebuffer object and bind the specified framebuffer object.
[in] | fbo | The framebuffer object that should be bound after unbinding |