X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgbase%2Fglcontext.cpp;h=b71383063c05d6edb036959e8034349897bff228;hb=7d2b4349289578b8e7f322186a1f251684ddeb01;hp=22dca9010462d922ad800f19447609e5a1735024;hpb=dce7552c5e2f64fcf5f58b0c934bb4a01f6cbcf7;p=libs%2Fgui.git diff --git a/source/gbase/glcontext.cpp b/source/gbase/glcontext.cpp index 22dca90..b713830 100644 --- a/source/gbase/glcontext.cpp +++ b/source/gbase/glcontext.cpp @@ -9,7 +9,7 @@ #endif #endif #include -#include +#include #include "display.h" #include "glcontext.h" #include "window.h" @@ -26,6 +26,12 @@ GLOptions::GLOptions(): { } +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; @@ -71,7 +77,7 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts): 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); @@ -112,7 +118,7 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts): 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; @@ -128,7 +134,7 @@ GLContext::GLContext(Window &wnd, const GLOptions &opts): #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));