This commit is contained in:
milek7
2018-06-25 01:15:37 +02:00
parent 0c5f990528
commit 694aac6065
13 changed files with 131 additions and 114 deletions

27
gl/bindable.h Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
namespace gl
{
template <typename T>
class bindable
{
private:
static bindable<T>* active;
public:
void bind()
{
if (active == this)
return;
active = this;
T::bind(*static_cast<T*>(active));
}
void unbind()
{
active = nullptr;
T::bind(0);
}
};
template <typename T> bindable<T>* bindable<T>::active;
}