]> git.tdb.fi Git - libs/gl.git/blobdiff - source/bindable.h
Lots of comment updates
[libs/gl.git] / source / bindable.h
index d85ec78daac037710390a7949c1deb164c3dbb51..76c2fb528b7967839fa606a6c8a076ce190ee525 100644 (file)
@@ -1,16 +1,13 @@
-/* $Id$
-
-This file is part of libmspgl
-Copyright © 2010  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_GL_BINDABLE_H_
 #define MSP_GL_BINDABLE_H_
 
 namespace Msp {
 namespace GL {
 
+/**
+A helper class for single-point binding.  Provides tracking of the currently
+bound object.
+*/
 template<typename T>
 class Bindable
 {
@@ -98,11 +95,21 @@ private:
        Base *binder;
 
 public:
+       template<typename T>
+       Bind(const T &o, bool r = false):
+               binder(r ? create(&o, T::current()) : create(&o))
+       { }
+
        template<typename T>
        Bind(const T *o, bool r = false):
                binder(r ? create(o, T::current()) : create(o))
        { }
 
+       template<typename T>
+       Bind(T *o, bool r = false):
+               binder(r ? create(o, T::current()) : create(o))
+       { }
+
 private:
        Bind(const Bind &);
        Bind &operator=(const Bind &);