]> git.tdb.fi Git - libs/gl.git/blob - source/core/device.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / core / device.cpp
1 #include "device.h"
2 #include "error.h"
3
4 namespace Msp {
5 namespace GL {
6
7 Device *Device::current = 0;
8
9 Device::Device(Graphics::Window &w):
10         Device(w, create_default_options())
11 { }
12
13 Device::Device(Graphics::Window &w, const DeviceOptions &o):
14         DeviceBackend(w, o)
15 {
16         current = this;
17
18         info.api = get_backend_api();
19         fill_info();
20 }
21
22 Device::~Device()
23 {
24         if(this==current)
25                 current = 0;
26 }
27
28 Device &Device::get_current()
29 {
30         if(!current)
31                 throw invalid_operation("no current device");
32         return *current;
33 }
34
35 } // namespace GL
36 } // namespace Msp