43 glDeleteBuffers(1, &
_fboId);
49 glDeleteBuffers(1, &
_rboId);
59 glGenFramebuffers(1, &
_fboId);
60 glGenRenderbuffers(1, &
_rboId);
62 glFramebufferRenderbuffer(GL_FRAMEBUFFER,
68 if ((glCheckFramebufferStatus(GL_FRAMEBUFFER)) != GL_FRAMEBUFFER_COMPLETE)
80 assert(
_fboId &&
"No framebuffer generated");
84 glGetIntegerv(GL_FRAMEBUFFER_BINDING, &prevFboId);
88 glBindFramebuffer(GL_FRAMEBUFFER,
_fboId);
90 assert(
_rboId &&
"No renderbuffer generated");
91 glBindRenderbuffer(GL_RENDERBUFFER,
_rboId);
99 glBindRenderbuffer(GL_RENDERBUFFER, 0);
109 glRenderbufferStorage(GL_RENDERBUFFER,
110 GL_DEPTH_COMPONENT24,
122 glFramebufferTexture2D(GL_FRAMEBUFFER,
#define SL_EXIT_MSG(message)
Wrapper class around OpenGL Frame Buffer Objects (FBO)
SLuint _prevFboId
previously active frame buffer identifier
void attachTexture2D(SLenum attachment, SLenum target, SLGLTexture *texture, SLint level=0)
Attaches texture image to framebuffer.
SLsizei _rboHeight
height of the render buffer
void clear()
Calls delete and clears data.
void bindAndSetBufferStorage(SLsizei width, SLsizei height)
Sets the size of the buffer storage.
static SLuint totalBufferCount
SLuint _fboId
static total size of all buffers in bytes
SLsizei _rboWidth
width of the render buffer
SLGLFrameBuffer(SLsizei rboWidth, SLsizei rboHeight)
Constructor.
void generate()
Generates the framebuffer.
static SLuint totalBufferSize
static total no. of buffers in use
void unbind()
Unbinds the framebuffer and renderbuffer.
SLuint _rboId
render buffer identifier
SLuint _sizeBytes
size in bytes of this buffer
void bind()
Binds the framebuffer and renderbuffer.
void deleteGL()
Deletes this buffers.
Texture object for OpenGL texturing.