X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmisc.h;h=11cb3a60fdc24f9d94e713f89f17cdd9bd351ca6;hb=98c810b6d2256aa65986bbde12c38917678121bb;hp=876904779ea983062b575e701e6e1e70df401445;hpb=f098a871fc6dc7b61a5aca5581fa327e4124c036;p=libs%2Fgl.git diff --git a/source/misc.h b/source/misc.h index 87690477..11cb3a60 100644 --- a/source/misc.h +++ b/source/misc.h @@ -8,13 +8,46 @@ Distributed under the LGPL #ifndef MSP_GL_MISC_H_ #define MSP_GL_MISC_H_ -#include +#include "gl.h" namespace Msp { namespace GL { +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 + struct Binder: Base + { + const T &obj; + + Binder(const T &o): obj(o) { obj.bind(); } + ~Binder() { obj.unbind(); } + }; + + Base *binder; + +public: + template + Bind(const T &o): binder(new Binder(o)) { } + ~Bind() { delete binder; } +}; + } // namespace GL } // namespace Msp