]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/glcontext.h
Use default member initializers and defaulted default constructors
[libs/gui.git] / source / graphics / glcontext.h
index db9df4e0aee08e3f150c17c826f2a578e1a142d7..7f08f0e4026423e7d1b3b7c3dd657eae0ff781b1 100644 (file)
@@ -11,12 +11,20 @@ class Window;
 
 struct GLOptions
 {
-       bool alpha;
-       bool stencil;
-       bool doublebuffer;
-       unsigned multisample;
+       enum
+       {
+               DEFAULT_VERSION = 0,
+               LATEST_VERSION = 0xFFFFFFFF
+       };
 
-       GLOptions();
+       bool alpha = false;
+       bool stencil = false;
+       bool doublebuffer = true;
+       unsigned multisample = 0;
+       bool forward_compatible = false;
+       bool core_profile = false;
+       unsigned gl_version_major = DEFAULT_VERSION;
+       unsigned gl_version_minor = DEFAULT_VERSION;
 };
 
 
@@ -24,7 +32,9 @@ class unsupported_gl_mode: public std::runtime_error
 {
 public:
        unsupported_gl_mode(const GLOptions &);
-       virtual ~unsupported_gl_mode() throw () { }
+
+private:
+       static std::string format_version(const GLOptions &);
 };
 
 
@@ -35,12 +45,18 @@ private:
 
        Display &display;
        Window &window;
-       Private *priv;
+       Private *priv = 0;
 
 public:
        GLContext(Window &wnd, const GLOptions &opts = GLOptions());
+       GLContext(Window &wnd, unsigned, unsigned);
+private:
+       void platform_init(const GLOptions &);
+public:
        ~GLContext();
 
+       void set_swap_interval(unsigned);
+
        void swap_buffers();
 private:
        void window_resized(unsigned, unsigned);