]> git.tdb.fi Git - libs/gl.git/blob - source/misc.h
Add get_width() / get_height() methods to Renderbuffer and Framebuffer
[libs/gl.git] / source / misc.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_MISC_H_
9 #define MSP_GL_MISC_H_
10
11 #include "gl.h"
12
13 namespace Msp {
14 namespace GL {
15
16 void enable(GLenum);
17 void disable(GLenum);
18 void set(GLenum, bool);
19
20 ///Deprecated (can't properly pass an array through a reference)
21 void get(GLenum, int &);
22
23 void get(GLenum, int *);
24 int get_i(GLenum);
25
26 class Bind
27 {
28 private:
29         struct Base
30         {
31                 virtual ~Base() { }
32         };
33
34         template<typename T>
35         struct Binder: Base
36         {
37                 const T &obj;
38
39                 Binder(const T &o): obj(o) { obj.bind(); }
40                 ~Binder() { obj.unbind(); }
41         };
42
43         Base *binder;
44
45 public:
46         template<typename T>
47         Bind(const T &o): binder(new Binder<T>(o)) { }
48         ~Bind() { delete binder; }
49 };
50
51 } // namespace GL
52 } // namespace Msp
53
54 #endif