X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fmisc.h;h=11cb3a60fdc24f9d94e713f89f17cdd9bd351ca6;hb=927a1aa0a3a27e463ec0efc08bd08e7c4e969909;hp=49c6cf5bd66a3e7728581142858c6726950226d5;hpb=7adcad3b40a03000a82e32db4523761c218309b8;p=libs%2Fgl.git diff --git a/source/misc.h b/source/misc.h index 49c6cf5b..11cb3a60 100644 --- a/source/misc.h +++ b/source/misc.h @@ -1,13 +1,53 @@ +/* $Id$ + +This file is part of libmspgl +Copyright © 2007 Mikko Rasa, Mikkosoft Productions +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