--- /dev/null
+#include "device.h"
+#include "error.h"
+
+namespace Msp {
+namespace GL {
+
+Device *Device::current = 0;
+
+Device::Device(Graphics::Window &w, const DeviceOptions &o):
+ DeviceBackend(w, o)
+{
+ current = this;
+}
+
+Device::~Device()
+{
+ if(this==current)
+ current = 0;
+}
+
+Device &Device::get_current()
+{
+ if(!current)
+ throw invalid_operation("no current device");
+ return *current;
+}
+
+} // namespace GL
+} // namespace Msp