![]() |
SLProject
4.3.020
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
Wrapper around an OpenGL framebuffer object for offscreen rendering. More...
#include <SLGLFbo.h>
Public Member Functions | |
| SLGLFbo (SLuint w, SLuint h, SLenum magFilter=GL_NEAREST, SLenum minFilter=GL_NEAREST, SLint internalFormat=GL_RGB16F, SLint format=GL_FLOAT, SLint wrap=GL_REPEAT) | |
| Creates the framebuffer, its colour texture and its depth renderbuffer. More... | |
| ~SLGLFbo () | |
| Deletes the texture, the renderbuffer and the framebuffer. More... | |
| void | activateAsTexture (int progId, const SLstring &samplerName, int textureUnit=0) |
| Binds the colour texture to a texture unit and sets the sampler uniform. More... | |
Public Attributes | |
| SLuint | width |
| Width of the framebuffer in pixels. More... | |
| SLuint | height |
| Height of the framebuffer in pixels. More... | |
| SLuint | attachment |
| SLuint | fboID |
| GL id of the framebuffer object. More... | |
| SLuint | texID |
| GL id of the colour attachment texture. More... | |
| SLuint | rboID |
| GL id of the depth renderbuffer. More... | |
Wrapper around an OpenGL framebuffer object for offscreen rendering.
An SLGLFbo owns three GL objects: a framebuffer, a 2D colour texture bound to GL_COLOR_ATTACHMENT0, and a renderbuffer holding a 24 bit depth buffer. Rendering into it and then binding the result as a texture is the usual way to implement a post-processing or reflection pass.
| SLGLFbo::SLGLFbo | ( | SLuint | w, |
| SLuint | h, | ||
| SLenum | magFilter = GL_NEAREST, |
||
| SLenum | minFilter = GL_NEAREST, |
||
| SLint | internalFormat = GL_RGB16F, |
||
| SLint | format = GL_FLOAT, |
||
| SLint | wrap = GL_REPEAT |
||
| ) |
Creates the framebuffer, its colour texture and its depth renderbuffer.
| w | Width in pixels |
| h | Height in pixels |
| magFilter | GL magnification filter of the colour texture |
| minFilter | GL minification filter of the colour texture |
| internalFormat | GL internal format of the colour texture |
| format | GL data type of the colour texture pixels |
| wrap | GL wrap mode applied to both S and T The previously bound framebuffer is restored before returning. A completeness failure is reported on stderr, not thrown. |
Definition at line 15 of file SLGLFbo.cpp.
| SLGLFbo::~SLGLFbo | ( | ) |
Deletes the texture, the renderbuffer and the framebuffer.
Definition at line 77 of file SLGLFbo.cpp.
Binds the colour texture to a texture unit and sets the sampler uniform.
| progId | GL id of the shader program holding the sampler |
| samplerName | Name of the sampler uniform in that program |
| textureUnit | Texture unit to bind to, added to GL_TEXTURE0 |
Definition at line 83 of file SLGLFbo.cpp.
| SLuint SLGLFbo::attachment |
| SLuint SLGLFbo::height |
| SLuint SLGLFbo::texID |