mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
vao
This commit is contained in:
27
gl/bindable.h
Normal file
27
gl/bindable.h
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user