+ priv = new Private;
+ if(opts.forward_compatible || opts.gl_version_major)
+ {
+ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs = reinterpret_cast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribs"));
+ if(!wglCreateContextAttribs)
+ throw unsupported_gl_mode(opts);
+
+ vector<int> ctx_attribs;
+
+ if(opts.forward_compatible)
+ {
+ ctx_attribs.push_back(WGL_CONTEXT_FLAGS_ARB);
+ ctx_attribs.push_back(WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB);
+ }
+
+ if(opts.gl_version_major)
+ {
+ ctx_attribs.push_back(WGL_CONTEXT_MAJOR_VERSION_ARB);
+ ctx_attribs.push_back(opts.gl_version_major);
+ ctx_attribs.push_back(WGL_CONTEXT_MINOR_VERSION_ARB);
+ ctx_attribs.push_back(opts.gl_version_minor);
+ }
+
+ ctx_attribs.push_back(0);
+
+ priv->context = wglCreateContextAttribs(dc, 0, &ctx_attribs[0]);
+ }
+ else
+ priv->context = wglCreateContext(dc);