LightsprintSDK 2021.08.08
|
#include <FBO.h>
Public Member Functions | |
void | restore () |
FBO () | |
Static Public Member Functions | |
static void | setRenderTarget (GLenum attachment, GLenum target, const Texture *texture, const FBO &oldState) |
static void | setRenderTargetGL (GLenum attachment, GLenum target, GLuint texture, const FBO &oldState) |
static void | setRenderBuffers (GLenum draw_buffer) |
static bool | isOk () |
static const FBO & | getState () |
Lets you set, save and restore render target.
rr_gl::FBO::FBO | ( | ) |
Initializes new instance of default framebuffer, without modifying OpenGL state. Calling restore() would restore default framebuffer.
|
static |
Sets render target.
Default (provided by windowing system) and non-default (texture) targets are never mixed, so by setting texture, any previous default render target is automatically unset. To render to custom color and depth textures, call setRenderTarget twice, once for each texture. To return back to default render target, call restore() on previously backed up state, or on newly constructed FBO.
attachment | GL_DEPTH_ATTACHMENT or GL_COLOR_ATTACHMENT0. |
target | GL_TEXTURE_2D or GL_TEXTURE_CUBE_MAP_POSITIVE_X or _NEGATIVE_X or _POSITIVE_Y or _NEGATIVE_Y or _POSITIVE_Z or _NEGATIVE_Z. |
texture | Texture to be set as render target. May be nullptr. If you set both color and depth, sizes must match. |
oldState | When setting nullptr color texture, setRenderBuffers(oldState.buffers) restores old buffers. |
|
static |
Similar to setRenderTarget(), but with raw OpenGL texture id instead of Lightsprint Texture.
|
static |
Wrapper for glDrawBuffer() and glReadBuffer().
It is used internally by setRenderTarget(), it is rarely needed outside. We only use it for setting left&right in quad buffered stereo. Possible parameters: GL_NONE, GL_COLOR_ATTACHMENT0, GL_BACK_LEFT, GL_BACK_RIGHT..
|
static |
Check whether render target is set correctly (all textures the same size etc).
|
static |
Return current state, what textures are set as render target.
void rr_gl::FBO::restore | ( | ) |
Restore saved state.