]> git.tdb.fi Git - libs/gui.git/blob - source/graphics/glcontext.h
Remove destructor declarations from exception classes
[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         enum
15         {
16                 DEFAULT_VERSION = 0,
17                 LATEST_VERSION = 0xFFFFFFFF
18         };
19
20         bool alpha;
21         bool stencil;
22         bool doublebuffer;
23         unsigned multisample;
24         bool forward_compatible;
25         bool core_profile;
26         unsigned gl_version_major;
27         unsigned gl_version_minor;
28
29         GLOptions();
30 };
31
32
33 class unsupported_gl_mode: public std::runtime_error
34 {
35 public:
36         unsupported_gl_mode(const GLOptions &);
37
38 private:
39         static std::string format_version(const GLOptions &);
40 };
41
42
43 class GLContext
44 {
45 private:
46         struct Private;
47
48         Display &display;
49         Window &window;
50         Private *priv;
51
52 public:
53         GLContext(Window &wnd, const GLOptions &opts = GLOptions());
54         GLContext(Window &wnd, unsigned, unsigned);
55 private:
56         void platform_init(const GLOptions &);
57 public:
58         ~GLContext();
59
60         void set_swap_interval(unsigned);
61
62         void swap_buffers();
63 private:
64         void window_resized(unsigned, unsigned);
65 };
66
67 } // namespace Graphics
68 } // namespace Msp
69
70 #endif