]> git.tdb.fi Git - libs/gui.git/blobdiff - source/graphics/glcontext.h
Add decorations for things which should be exported from the library
[libs/gui.git] / source / graphics / glcontext.h
index ef6ef1b60f25989431e4d710c5916a84bdc64af1..38c36b109d9bfc0f14b3dcbbb6240d68fd6ff203 100644 (file)
@@ -2,6 +2,7 @@
 #define MSP_GRAPHICS_GLCONTEXT_H_
 
 #include <stdexcept>
+#include "mspgui_api.h"
 
 namespace Msp {
 namespace Graphics {
@@ -11,38 +12,42 @@ class Window;
 
 struct GLOptions
 {
-       bool alpha;
-       bool stencil;
-       bool doublebuffer;
-       unsigned multisample;
-       bool forward_compatible;
-       bool core_profile;
-       unsigned gl_version_major;
-       unsigned gl_version_minor;
-
-       GLOptions();
+       static constexpr unsigned DEFAULT_VERSION = 0;
+       static constexpr unsigned LATEST_VERSION = 0xFFFFFFFF;
+
+       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;
 };
 
 
-class unsupported_gl_mode: public std::runtime_error
+class MSPGUI_API 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 &);
 };
 
 
-class GLContext
+class MSPGUI_API GLContext
 {
 private:
        struct Private;
 
        Display &display;
        Window &window;
-       Private *priv;
+       Private *priv = nullptr;
 
 public:
        GLContext(Window &wnd, const GLOptions &opts = GLOptions());
+       GLContext(Window &wnd, unsigned, unsigned);
 private:
        void platform_init(const GLOptions &);
 public: