#pragma once namespace gl { template class bindable { private: static bindable* active; public: void bind() { if (active == this) return; active = this; T::bind(*static_cast(active)); } static void unbind() { active = nullptr; T::bind(0); } }; template bindable* bindable::active; }