]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/glcontext.h
8cf75c82948fc657869e1d3685dbfcfeb4133233
[libs/gui.git] / source / graphics / glcontext.h
1 #ifndef MSP_GRAPHICS_GLCONTEXT_H_
2 #define MSP_GRAPHICS_GLCONTEXT_H_
3
4 #include <stdexcept>
5
6 namespace Msp {
7 namespace Graphics {
8
9 class Display;
10 class Window;
11
12 struct GLOptions
13 {
14         bool alpha;
15         bool stencil;
16         bool doublebuffer;
17         unsigned multisample;
18
19         GLOptions();
20 };
21
22
23 class unsupported_gl_mode: public std::runtime_error
24 {
25 public:
26         unsupported_gl_mode(const GLOptions &);
27         virtual ~unsupported_gl_mode() throw () { }
28 };
29
30
31 class GLContext
32 {
33 private:
34         struct Private;
35
36         Display &display;
37         Window &window;
38         Private *priv;
39
40 public:
41         GLContext(Window &wnd, const GLOptions &opts = GLOptions());
42 private:
43         void platform_init(const GLOptions &);
44 public:
45         ~GLContext();
46
47         void set_swap_interval(unsigned);
48
49         void swap_buffers();
50 private:
51         void window_resized(unsigned, unsigned);
52 };
53
54 } // namespace Graphics
55 } // namespace Msp
56
57 #endif