4 #include "framebuffer.h" 6 #include "renderbuffer.h" 9 void Framebuffer::destroy() {
12 cleanup([fbo]() { V_GL(glDeleteFramebuffers(1, &fbo)); });
17 void Framebuffer::create() {
19 V_GL(glGenFramebuffers(1, &_id));
23 void Framebuffer::bind() {
25 V_GL(glBindFramebuffer(GL_FRAMEBUFFER, _id));
28 void Framebuffer::attach(
Renderbuffer &renderbuffer,
int attachment) {
30 renderbuffer.create();
31 V_GL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER,
35 void Framebuffer::attach(
Texture &texture,
int attachment) {
37 V_GL(glFramebufferTexture(GL_FRAMEBUFFER, attachment, texture.id(), 0));