1 #ifndef MSP_GL_RENDERBUFFER_H_
2 #define MSP_GL_RENDERBUFFER_H_
5 #include "pixelformat.h"
11 A Renderbuffer contains a single renderable image. It can be attached to a
12 Framebuffer to provide a logical buffer that is required to render the scene
13 correctly but that is not needed as a texture later. Renderbuffers also
14 provide a capability for multisampling, which is not available in textures.
16 Requires the GL_EXT_framebuffer_object extension. Multisample renderbuffers
17 additionally require the GL_EXT_framebuffer_multisample extension.
19 class Renderbuffer: public Bindable<Renderbuffer>
30 unsigned get_id() const { return id; }
31 unsigned get_width() const { return width; }
32 unsigned get_height() const { return height; }
34 /** Allocates storage for the renderbuffer. */
35 void storage(PixelFormat fmt, unsigned wd, unsigned ht);
37 /** Returns the maximum supported sample count for multisampling. If
38 multisampling is not supported, returns 0. */
39 static unsigned get_max_samples();
41 /** Allocates multisample storage for the renderbuffer. All attachments in
42 a framebuffer must have the same number of samples. To transfer the
43 contents to a texture for furter processing, use the framebuffer blit
45 void storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht);