]> git.tdb.fi Git - libs/gl.git/blob - source/core/renderbuffer.h
84ed3f28415fa95becfc47152e9a9344b479765f
[libs/gl.git] / source / core / renderbuffer.h
1 #ifndef MSP_GL_RENDERBUFFER_H_
2 #define MSP_GL_RENDERBUFFER_H_
3
4 #include "pixelformat.h"
5
6 namespace Msp {
7 namespace GL {
8
9 /**
10 A Renderbuffer contains a single renderable image.  It can be attached to a
11 Framebuffer to provide a logical buffer that is required to render the scene
12 correctly but that is not needed as a texture later.  Renderbuffers also
13 provide a capability for multisampling, which is not available in textures.
14
15 Requires the GL_EXT_framebuffer_object extension.  Multisample renderbuffers
16 additionally require the GL_EXT_framebuffer_multisample extension.
17 */
18 class Renderbuffer
19 {
20 private:
21         unsigned id;
22         unsigned width;
23         unsigned height;
24
25 public:
26         Renderbuffer();
27         ~Renderbuffer();
28
29         unsigned get_id() const { return id; }
30         unsigned get_width() const { return width; }
31         unsigned get_height() const { return height; }
32
33         /** Allocates storage for the renderbuffer. */
34         void storage(PixelFormat fmt, unsigned wd, unsigned ht);
35
36         /** Returns the maximum supported sample count for multisampling.  If
37         multisampling is not supported, returns 0. */
38         DEPRECATED static unsigned get_max_samples();
39
40         /** Allocates multisample storage for the renderbuffer.  All attachments in
41         a framebuffer must have the same number of samples.  To transfer the
42         contents to a texture for furter processing, use the framebuffer blit
43         functions.*/
44         void storage_multisample(unsigned samples, PixelFormat fmt, unsigned wd, unsigned ht);
45
46         void set_debug_name(const std::string &);
47 };
48
49 } // namespace GL
50 } // namespace Msp
51
52 #endif