]> git.tdb.fi Git - libs/gl.git/blob - source/renderbuffer.h
Rework Bind and enable it to restore the old binding
[libs/gl.git] / source / renderbuffer.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_RENDERBUFFER_H_
9 #define MSP_GL_RENDERBUFFER_H_
10
11 #include "bindable.h"
12 #include "pixelformat.h"
13
14 namespace Msp {
15 namespace GL {
16
17 /**
18 A Renderbuffer contains a single renderable image.  It can be attached to a
19 Framebuffer to provide a logical buffer that is required to render the scene
20 correctly but that is not needed as a texture later.
21
22 Requires the GL_EXT_framebuffer_object extension.
23 */
24 class Renderbuffer: public Bindable<Renderbuffer>
25 {
26 private:
27         unsigned id;
28         unsigned width;
29         unsigned height;
30
31 public:
32         Renderbuffer();
33         ~Renderbuffer();
34
35         unsigned get_id() const { return id; }
36         unsigned get_width() const { return width; }
37         unsigned get_height() const { return height; }
38
39         void storage(PixelFormat fmt, unsigned width, unsigned height);
40
41         void bind() const;
42
43         static void unbind();
44 };
45
46 } // namespace GL
47 } // namespace Msp
48
49 #endif