-/* $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
{
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 &);