I got this error too on nvidia when requesting a context with a version &lt;= 3.2, but from what I understand from the spec, this is not the correct behavior.<br>
The 0x2096 part corresponds to ERROR_INVALID_PROFILE_ARB (I don&#39;t know 
what is the meaning of the 0xc0070000 part and if it is nvidia specific 
or not). <br><br>
I would be very interested to know what is the behavior of others vendors but I only have nvidia hardware here.<br><br><div class="gmail_quote">On Wed, Nov 2, 2011 at 1:17 PM, Jose Fonseca <span dir="ltr">&lt;<a href="mailto:jfonseca@vmware.com">jfonseca@vmware.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I&#39;ve pushed, but it doesn&#39;t work on nvidia.<br>
<br>
It fails with error 0xc0072096.<br>
<br>
Have you tried with different implementations?<br>
<br>
Jose<br>
<div><div></div><div class="h5"><br>
----- Original Message -----<br>
&gt; ---<br>
&gt;  src/wgl/CMakeLists.txt |    1 +<br>
&gt;  src/wgl/wglcontext.c   |  274<br>
&gt; ++++++++++++++++++++++++++++++++++++++++++++++++<br>
&gt;  2 files changed, 275 insertions(+), 0 deletions(-)<br>
&gt;  create mode 100644 src/wgl/wglcontext.c<br>
&gt;<br>
&gt; diff --git a/src/wgl/CMakeLists.txt b/src/wgl/CMakeLists.txt<br>
&gt; index 834e836..88e6a20 100644<br>
&gt; --- a/src/wgl/CMakeLists.txt<br>
&gt; +++ b/src/wgl/CMakeLists.txt<br>
&gt; @@ -13,5 +13,6 @@ add_executable (wgl_sharedtex_mt sharedtex_mt.c)<br>
&gt;  set_target_properties (wgl_sharedtex_mt PROPERTIES OUTPUT_NAME<br>
&gt; sharedtex_mt)<br>
&gt;<br>
&gt;  add_executable (wglinfo wglinfo.c)<br>
&gt; +add_executable (wglcontext wglcontext.c)<br>
&gt;<br>
&gt;  install (TARGETS wglthreads wgl_sharedtex_mt wglinfo DESTINATION<br>
&gt;  wgl)<br>
&gt; diff --git a/src/wgl/wglcontext.c b/src/wgl/wglcontext.c<br>
&gt; new file mode 100644<br>
&gt; index 0000000..41e44cd<br>
&gt; --- /dev/null<br>
&gt; +++ b/src/wgl/wglcontext.c<br>
&gt; @@ -0,0 +1,274 @@<br>
&gt; +/*<br>
&gt; + * Copyright (C) 2011 Morgan Armand &lt;<a href="mailto:morgan.devel@gmail.com">morgan.devel@gmail.com</a>&gt;<br>
&gt; + *<br>
&gt; + * Permission is hereby granted, free of charge, to any person<br>
&gt; obtaining a<br>
&gt; + * copy of this software and associated documentation files (the<br>
&gt; &quot;Software&quot;),<br>
&gt; + * to deal in the Software without restriction, including without<br>
&gt; limitation<br>
&gt; + * the rights to use, copy, modify, merge, publish, distribute,<br>
&gt; sublicense,<br>
&gt; + * and/or sell copies of the Software, and to permit persons to whom<br>
&gt; the<br>
&gt; + * Software is furnished to do so, subject to the following<br>
&gt; conditions:<br>
&gt; + *<br>
&gt; + * The above copyright notice and this permission notice shall be<br>
&gt; included<br>
&gt; + * in all copies or substantial portions of the Software.<br>
&gt; + *<br>
&gt; + * THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,<br>
&gt; EXPRESS<br>
&gt; + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF<br>
&gt; MERCHANTABILITY,<br>
&gt; + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO<br>
&gt; EVENT SHALL<br>
&gt; + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,<br>
&gt; WHETHER IN<br>
&gt; + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR<br>
&gt; IN<br>
&gt; + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE<br>
&gt; SOFTWARE.<br>
&gt; + */<br>
&gt; +<br>
&gt; +#include &lt;windows.h&gt;<br>
&gt; +#include &lt;stdio.h&gt;<br>
&gt; +#include &lt;stdlib.h&gt;<br>
&gt; +#include &lt;GL/gl.h&gt;<br>
&gt; +#include &lt;GL/glext.h&gt;<br>
&gt; +#include &lt;GL/wglext.h&gt;<br>
&gt; +<br>
&gt; +static LRESULT CALLBACK<br>
&gt; +WndProc(HWND hWnd,<br>
&gt; +        UINT uMsg,<br>
&gt; +        WPARAM wParam,<br>
&gt; +        LPARAM lParam )<br>
&gt; +{<br>
&gt; +   switch (uMsg) {<br>
&gt; +   case WM_DESTROY:<br>
&gt; +      PostQuitMessage(0);<br>
&gt; +      break;<br>
&gt; +   default:<br>
&gt; +      return DefWindowProc(hWnd, uMsg, wParam, lParam);<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   return 0;<br>
&gt; +}<br>
&gt; +<br>
&gt; +static char *<br>
&gt; +context_error_to_string(DWORD error)<br>
&gt; +{<br>
&gt; +   switch (error) {<br>
&gt; +   case ERROR_INVALID_VERSION_ARB:  return<br>
&gt; &quot;ERROR_INVALID_VERSION_ARB&quot;;<br>
&gt; +   case ERROR_INVALID_PROFILE_ARB:  return<br>
&gt; &quot;ERROR_INVALID_PROFILE_ARB&quot;;<br>
&gt; +   case ERROR_INVALID_OPERATION:    return<br>
&gt; &quot;ERROR_INVALID_OPERATION&quot;;<br>
&gt; +   case ERROR_DC_NOT_FOUND:         return &quot;ERROR_DC_NOT_FOUND&quot;;<br>
&gt; +   case ERROR_INVALID_PIXEL_FORMAT: return<br>
&gt; &quot;ERROR_INVALID_PIXEL_FORMAT&quot;;<br>
&gt; +   case ERROR_NO_SYSTEM_RESOURCES:  return<br>
&gt; &quot;ERROR_NO_SYSTEM_RESOURCES&quot;;<br>
&gt; +   case ERROR_INVALID_PARAMETER:    return<br>
&gt; &quot;ERROR_INVALID_PARAMETER&quot;;<br>
&gt; +   default:                         return &quot;Unknown Error&quot;;<br>
&gt; +   }<br>
&gt; +}<br>
&gt; +<br>
&gt; +static char *<br>
&gt; +profile_mask_to_string(GLint profileMask)<br>
&gt; +{<br>
&gt; +   switch (profileMask) {<br>
&gt; +   case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:<br>
&gt; +      return &quot;WGL_CONTEXT_CORE_PROFILE_BIT_ARB&quot;;<br>
&gt; +   case WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB:<br>
&gt; +      return &quot;WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB&quot;;<br>
&gt; +   default:<br>
&gt; +      return &quot;0&quot;;<br>
&gt; +   }<br>
&gt; +}<br>
&gt; +<br>
&gt; +static void<br>
&gt; +print_context_infos()<br>
&gt; +{<br>
&gt; +   GLint majorVersion;<br>
&gt; +   GLint minorVersion;<br>
&gt; +   GLint profileMask;<br>
&gt; +   const GLubyte *version;<br>
&gt; +<br>
&gt; +   fprintf(stdout, &quot;Context Informations\n&quot;);<br>
&gt; +<br>
&gt; +   version = glGetString(GL_VERSION);<br>
&gt; +   fprintf(stdout, &quot;GL_VERSION: %s\n&quot;, glGetString(GL_VERSION));<br>
&gt; +<br>
&gt; +   // Request informations with the new 3.x features.<br>
&gt; +   if (sscanf(version, &quot;%d.%d&quot;, &amp;majorVersion, &amp;minorVersion) != 2)<br>
&gt; +      return;<br>
&gt; +<br>
&gt; +   if (majorVersion &gt;= 3) {<br>
&gt; +      glGetIntegerv(GL_MAJOR_VERSION, &amp;majorVersion);<br>
&gt; +      glGetIntegerv(GL_MINOR_VERSION, &amp;minorVersion);<br>
&gt; +      glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &amp;profileMask);<br>
&gt; +      fprintf(stdout, &quot;GL_MAJOR_VERSION: %d\n&quot;, majorVersion);<br>
&gt; +      fprintf(stdout, &quot;GL_MINOR_VERSION: %d\n&quot;, minorVersion);<br>
&gt; +      fprintf(stdout, &quot;GL_CONTEXT_PROFILE_MASK: %s\n&quot;,<br>
&gt; profile_mask_to_string(profileMask));<br>
&gt; +   }<br>
&gt; +}<br>
&gt; +<br>
&gt; +static void<br>
&gt; +create_context(int majorVersion, int minorVersion, int profileMask,<br>
&gt; int<br>
&gt; contextFlags)<br>
&gt; +{<br>
&gt; +   WNDCLASS wc;<br>
&gt; +   HWND win;<br>
&gt; +   HDC hdc;<br>
&gt; +   PIXELFORMATDESCRIPTOR pfd;<br>
&gt; +   int pixelFormat;<br>
&gt; +   HGLRC tmp, ctx;<br>
&gt; +   PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;<br>
&gt; +   int attribsList[] = {<br>
&gt; +      WGL_CONTEXT_MAJOR_VERSION_ARB, 1,<br>
&gt; +      WGL_CONTEXT_MINOR_VERSION_ARB, 0,<br>
&gt; +      WGL_CONTEXT_FLAGS_ARB, 0,<br>
&gt; +      WGL_CONTEXT_PROFILE_MASK_ARB,<br>
&gt; WGL_CONTEXT_CORE_PROFILE_BIT_ARB,<br>
&gt; +      0<br>
&gt; +   };<br>
&gt; +<br>
&gt; +   memset(&amp;wc, 0, sizeof(wc));<br>
&gt; +   wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;<br>
&gt; +   wc.lpfnWndProc = WndProc;<br>
&gt; +   wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);<br>
&gt; +   wc.hCursor = LoadCursor(NULL, IDC_ARROW);<br>
&gt; +   wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);<br>
&gt; +   wc.lpszClassName = &quot;wglcontext&quot;;<br>
&gt; +<br>
&gt; +   if (!RegisterClass(&amp;wc)) {<br>
&gt; +      fprintf(stderr, &quot;RegisterClass() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   win = CreateWindowEx(0,<br>
&gt; +                     wc.lpszClassName,<br>
&gt; +                     &quot;wglinfo&quot;,<br>
&gt; +                     WS_CLIPSIBLINGS | WS_CLIPCHILDREN,<br>
&gt; +                     CW_USEDEFAULT,<br>
&gt; +                     CW_USEDEFAULT,<br>
&gt; +                     CW_USEDEFAULT,<br>
&gt; +                     CW_USEDEFAULT,<br>
&gt; +                     NULL,<br>
&gt; +                     NULL,<br>
&gt; +                     wc.hInstance,<br>
&gt; +                     NULL);<br>
&gt; +   if (!win) {<br>
&gt; +      fprintf(stderr, &quot;CreateWindowEx() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   hdc = GetDC(win);<br>
&gt; +   if (!hdc) {<br>
&gt; +      fprintf(stderr, &quot;GetDC() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   memset(&amp;pfd, 0, sizeof(pfd));<br>
&gt; +   pfd.nVersion = 1;<br>
&gt; +   pfd.nSize = sizeof(pfd);<br>
&gt; +   pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;<br>
&gt; +   pfd.iPixelType = PFD_TYPE_RGBA;<br>
&gt; +   pfd.cColorBits = 24;<br>
&gt; +   pfd.cDepthBits = 24;<br>
&gt; +   pfd.iLayerType = PFD_MAIN_PLANE;<br>
&gt; +<br>
&gt; +   pixelFormat = ChoosePixelFormat(hdc, &amp;pfd);<br>
&gt; +   if (!pixelFormat) {<br>
&gt; +      fprintf(stderr, &quot;ChoosePixelFormat() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   if (!SetPixelFormat(hdc, pixelFormat, &amp;pfd)) {<br>
&gt; +      fprintf(stderr, &quot;SetPixelFormat() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   tmp = wglCreateContext(hdc);<br>
&gt; +   if (!tmp) {<br>
&gt; +      fprintf(stderr, &quot;wglCreateContext() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   if (!wglMakeCurrent(hdc, tmp)) {<br>
&gt; +      fprintf(stderr, &quot;wglMakeCurrent() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   wglCreateContextAttribsARB =<br>
&gt; +<br>
&gt; (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress(&quot;wglCreateContextAttribsARB&quot;);<br>
&gt; +<br>
&gt; +   if (!wglCreateContextAttribsARB) {<br>
&gt; +      fprintf(stderr, &quot;wglCreateContextAttribsARB isn&#39;t<br>
&gt; supported\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   attribsList[1] = majorVersion;<br>
&gt; +   attribsList[3] = minorVersion;<br>
&gt; +   attribsList[5] = contextFlags;<br>
&gt; +   attribsList[7] = profileMask;<br>
&gt; +<br>
&gt; +   ctx = wglCreateContextAttribsARB(hdc, 0, attribsList);<br>
&gt; +   if (!ctx) {<br>
&gt; +      DWORD error = GetLastError();<br>
&gt; +      fprintf(stderr, &quot;wglCreateContextAttribsARB failed(): %s<br>
&gt; (0x%x)\n&quot;,<br>
&gt; +              context_error_to_string(error), error);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   wglMakeCurrent(NULL, NULL);<br>
&gt; +   wglDeleteContext(tmp);<br>
&gt; +<br>
&gt; +   if (!wglMakeCurrent(hdc, ctx)) {<br>
&gt; +      fprintf(stderr, &quot;wglMakeCurrent() failed\n&quot;);<br>
&gt; +      return;<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   print_context_infos(majorVersion);<br>
&gt; +}<br>
&gt; +<br>
&gt; +static void<br>
&gt; +usage(void)<br>
&gt; +{<br>
&gt; +   fprintf(stdout, &quot;Usage: wglcontext [-h] [-major &lt;major&gt;] [-minor<br>
&gt; &lt;minor&gt;] [-core] [-compat] [-debug] [-forward]\n&quot;);<br>
&gt; +   fprintf(stdout, &quot;   -major   : specify the major version you<br>
&gt; want\n&quot;);<br>
&gt; +   fprintf(stdout, &quot;   -minor   : specify the minor version you<br>
&gt; want\n&quot;);<br>
&gt; +   fprintf(stdout, &quot;   -core    : request a context implementing the<br>
&gt; core profile\n&quot;);<br>
&gt; +   fprintf(stdout, &quot;   -compat  : request a context implementing the<br>
&gt; compatibility profile\n&quot;);<br>
&gt; +   fprintf(stdout, &quot;   -debug   : request a debug context\n&quot;);<br>
&gt; +   fprintf(stdout, &quot;   -forward : request a forward-compatible<br>
&gt; context\n&quot;);<br>
&gt; +<br>
&gt; +}<br>
&gt; +<br>
&gt; +int<br>
&gt; +main(int argc, char *argv[])<br>
&gt; +{<br>
&gt; +   int i;<br>
&gt; +   int majorVersion = 1, minorVersion = 0;<br>
&gt; +   int contextFlags = 0x0;<br>
&gt; +   int profileMask = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;<br>
&gt; +<br>
&gt; +   for (i = 1; i &lt; argc; i++) {<br>
&gt; +      if (strcmp(argv[i], &quot;-h&quot;) == 0) {<br>
&gt; +         usage();<br>
&gt; +         exit(0);<br>
&gt; +      }<br>
&gt; +      else if (strcmp(argv[i], &quot;-major&quot;) == 0 &amp;&amp; i + 1 &lt; argc) {<br>
&gt; +         majorVersion = (int)strtol(argv[i + 1], (char **)NULL, 10);<br>
&gt; +         i++;<br>
&gt; +      }<br>
&gt; +      else if (strcmp(argv[i], &quot;-minor&quot;) == 0 &amp;&amp; i + 1 &lt; argc) {<br>
&gt; +         minorVersion = (int)strtol(argv[i + 1], (char **)NULL, 10);<br>
&gt; +         i++;<br>
&gt; +      }<br>
&gt; +      else if (strcmp(argv[i], &quot;-core&quot;) == 0) {<br>
&gt; +         profileMask = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;<br>
&gt; +      }<br>
&gt; +      else if (strcmp(argv[i], &quot;-compat&quot;) == 0) {<br>
&gt; +         profileMask = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;<br>
&gt; +      }<br>
&gt; +      else if (strcmp(argv[i], &quot;-debug&quot;) == 0) {<br>
&gt; +         contextFlags |= WGL_CONTEXT_DEBUG_BIT_ARB;<br>
&gt; +      }<br>
&gt; +      else if (strcmp(argv[i], &quot;-forward&quot;) == 0) {<br>
&gt; +         contextFlags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;<br>
&gt; +      }<br>
&gt; +      else {<br>
&gt; +         usage();<br>
&gt; +         exit(1);<br>
&gt; +      }<br>
&gt; +   }<br>
&gt; +<br>
&gt; +   create_context(majorVersion, minorVersion,<br>
&gt; +                  profileMask, contextFlags);<br>
&gt; +<br>
&gt; +   return 0;<br>
&gt; +}<br>
&gt; --<br>
&gt; 1.7.7.1.msysgit.0<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; mesa-dev mailing list<br>
&gt; <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
&gt; <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
&gt;<br>
</blockquote></div><br>