]> git.tdb.fi Git - libs/gl.git/blobdiff - source/misc.h
Add get_width() / get_height() methods to Renderbuffer and Framebuffer
[libs/gl.git] / source / misc.h
index 8a956a5ab4a26306f06abd4869a2dd6b42a93d43..11cb3a60fdc24f9d94e713f89f17cdd9bd351ca6 100644 (file)
@@ -17,6 +17,37 @@ void enable(GLenum);
 void disable(GLenum);
 void set(GLenum, bool);
 
+///Deprecated (can't properly pass an array through a reference)
+void get(GLenum, int &);
+
+void get(GLenum, int *);
+int get_i(GLenum);
+
+class Bind
+{
+private:
+       struct Base
+       {
+               virtual ~Base() { }
+       };
+
+       template<typename T>
+       struct Binder: Base
+       {
+               const T &obj;
+
+               Binder(const T &o): obj(o) { obj.bind(); }
+               ~Binder() { obj.unbind(); }
+       };
+
+       Base *binder;
+
+public:
+       template<typename T>
+       Bind(const T &o): binder(new Binder<T>(o)) { }
+       ~Bind() { delete binder; }
+};
+
 } // namespace GL
 } // namespace Msp