X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fglcontext.cpp;h=a66ca307b726a59a7ca1a025137b377fc401bd7c;hb=11ab96ba152e389814543a6398e2cd6f17a31092;hp=47e1e59456cf50478cd3df8798b925407c643ec9;hpb=213ca43656411a06bbf1c0d18e4ebacaf545eb34;p=libs%2Fgui.git diff --git a/source/graphics/glcontext.cpp b/source/graphics/glcontext.cpp index 47e1e59..a66ca30 100644 --- a/source/graphics/glcontext.cpp +++ b/source/graphics/glcontext.cpp @@ -1,6 +1,6 @@ +#include "glcontext.h" #include #include -#include "glcontext.h" #include "window.h" using namespace std; @@ -8,19 +8,21 @@ using namespace std; namespace Msp { namespace Graphics { -GLOptions::GLOptions(): - alpha(false), - stencil(false), - doublebuffer(true), - multisample(0) -{ } - - 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)) + runtime_error(format("{ .alpha=%s, .stencil=%s, .doublebuffer=%s, .multisample=%d, .forward_compatible=%s, .core_profile=%s, .gl_version=%s }", + opts.alpha, opts.stencil, opts.doublebuffer, opts.multisample, opts.forward_compatible, opts.core_profile, format_version(opts))) { } +string unsupported_gl_mode::format_version(const GLOptions &opts) +{ + if(opts.gl_version_major==GLOptions::LATEST_VERSION) + return "LATEST"; + else if(opts.gl_version_major==GLOptions::DEFAULT_VERSION) + return "DEFAULT"; + else + return format("%d.%d", opts.gl_version_major, opts.gl_version_minor); +} + GLContext::GLContext(Window &wnd, const GLOptions &opts):