#endif
#endif
#include <msp/core/application.h>
-#include <msp/core/except.h>
+#include <msp/strings/format.h>
#include "display.h"
#include "glcontext.h"
#include "window.h"
{ }
+unsupported_gl_mode::unsupported_gl_mode(const GLOptions &opts):
+ runtime_error(format("{ .alpha=%s, .stencil=%s, .doublebuffer=%s, .multisample=%d }",
+ opts.alpha, opts.stencil, opts.doublebuffer, opts.multisample))
+{ }
+
+
#ifdef WITH_OPENGL
#ifdef WIN32
typedef HGLRC Context;
int pf_index = ChoosePixelFormat(dc, &pfd);
if(!pf_index)
- throw Exception("Couldn't find a suitable pixel format");
+ throw unsupported_gl_mode(opts);
SetPixelFormat(dc, pf_index, &pfd);
priv->context = wglCreateContext(dc);
XVisualInfo *vi = glXChooseVisual(dpy, DefaultScreen(dpy), &attribs.front());
if(!vi)
- throw Exception("Couldn't find a suitable GLX visual");
+ throw unsupported_gl_mode(opts);
priv->context = glXCreateContext(dpy, vi, 0, true);
XSetWindowAttributes attr;
#else
(void)wnd;
(void)opts;
- throw Exception("OpenGL support not compiled in");
+ throw runtime_error("no OpenGL support");
#endif
window.signal_resize.connect(sigc::mem_fun(this, &GLContext::window_resized));