11 Renderbuffer* Renderbuffer::current =
nullptr;
14 glGenRenderbuffers(1, &handle);
18 glDeleteRenderbuffers(1, &handle);
21 if (Renderbuffer::current ==
this) {
22 Renderbuffer::current =
nullptr;
32 if (Renderbuffer::current ==
this) {
37 glBindRenderbuffer(GL_RENDERBUFFER, handle);
38 Renderbuffer::current =
this;
42 glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, width, height);
48 glGenFramebuffers(1, &handle);
52 glDeleteFramebuffers(1, &handle);
55 if (FramebufferGL::current ==
this) {
56 FramebufferGL::current =
nullptr;
66 if (FramebufferGL::current ==
this) {
71 glBindFramebuffer(GL_FRAMEBUFFER, handle);
72 FramebufferGL::current =
this;
76 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture->
getHandle(), 0);
80 glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, buffer->
getHandle());
FramebufferGL(void)
Generates a new framebuffer object.
void storage(int width, int height)
Allocates data storage, format and dimensions of the renderbuffer object.
GLuint getHandle()
Returns the handle of the framebuffer object.
GLuint getHandle()
Returns the handle of the renderbuffer object.
Generic namespace for the SimpleGL framework.
void bind()
Binds the framebuffer object.
~Renderbuffer(void)
Deletes the renderbuffer object.
~FramebufferGL(void)
Deletes the framebuffer object.
void setTexture(Texture *texture)
Sets a texture object as a logical buffer to the framebuffer object.
This class wraps an OpenGL texture object.
GLuint getHandle()
Returns the handle of the texture object.
This class wraps an OpenGL framebuffer object.
void setRenderbuffer(Renderbuffer *buffer)
Sets a renderbuffer object as a logical buffer to the framebuffer object.
Renderbuffer(void)
Generates a new renderbuffer object.
This class wraps an OpenGL renderbuffer object.
void bind()
Binds the renderbuffer object.