priv = new Private;
if(opts.forward_compatible || opts.gl_version_major)
{
- PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs = reinterpret_cast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribs"));
+ ContextHandle fake_context = wglCreateContext(dc);
+ wglMakeCurrent(dc, fake_context);
+
+ PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs = reinterpret_cast<PFNWGLCREATECONTEXTATTRIBSARBPROC>(wglGetProcAddress("wglCreateContextAttribsARB"));
if(!wglCreateContextAttribs)
throw unsupported_gl_mode(opts);
ctx_attribs.push_back(0);
priv->context = wglCreateContextAttribs(dc, 0, &ctx_attribs[0]);
+ if(!priv->context)
+ throw unsupported_gl_mode(opts);
+
+ wglMakeCurrent(0, 0);
+ wglDeleteContext(fake_context);
}
else
priv->context = wglCreateContext(dc);