1 #include <msp/gl/extensions/ext_framebuffer_multisample.h>
2 #include <msp/gl/extensions/ext_framebuffer_object.h>
3 #include "renderbuffer.h"
8 Renderbuffer::Renderbuffer()
10 static Require _req(EXT_framebuffer_object);
12 glGenRenderbuffers(1, &id);
15 Renderbuffer::~Renderbuffer()
17 glDeleteRenderbuffers(1, &id);
20 void Renderbuffer::storage(PixelFormat fmt, unsigned wd, unsigned ht)
22 require_pixelformat(fmt);
23 BindRestore _bind(this);
26 glRenderbufferStorage(GL_RENDERBUFFER, fmt, width, height);
29 void Renderbuffer::storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht)
31 static Require _req(EXT_framebuffer_multisample);
32 require_pixelformat(fmt);
34 BindRestore _bind(this);
37 glRenderbufferStorageMultisample(GL_RENDERBUFFER, samples, fmt, width, height);
40 void Renderbuffer::bind() const
43 glBindRenderbuffer(GL_RENDERBUFFER, id);
46 void Renderbuffer::unbind()
49 glBindRenderbuffer(GL_RENDERBUFFER, 0);