<div dir="ltr">On 19 December 2012 12:21, Chad Versace <span dir="ltr"><<a href="mailto:chad.versace@linux.intel.com" target="_blank">chad.versace@linux.intel.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">With NVidia, calling glXCreateContextAttribsARB with MAJOR=1 and MINOR=0<br>
returns an OpenGL 2.1 context. Calling it with MAJOR and MINOR unspecified<br>
returns a context of the latest supported OpenGL version. However, according to<br>
the GLX_ARB_create_context spec, the two calls should behave identically.<br>
Calling with MAJOR and MINOR unspecified produces the expected behavior.<br>
<br>
As a workaround, do not specify GLX_CONTEXT_MAJOR_VERSION_ARB and<br>
GLX_CONTEXT_MINOR_VERSION_ARB in the call to glXCreateContextAttribsARB if the<br>
user requested an OpenGL context of unspecified version or if the user<br>
explicitly requested an OpenGL 1.0 context.<br>
<br>
Reported-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
Signed-off-by: Chad Versace <<a href="mailto:chad.versace@linux.intel.com">chad.versace@linux.intel.com</a>><br></blockquote><div><br></div><div>Reviewed-and-tested-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>>.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
 src/waffle/glx/glx_context.c | 37 ++++++++++++++++++++++++++++++++-----<br>
 1 file changed, 32 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/waffle/glx/glx_context.c b/src/waffle/glx/glx_context.c<br>
index bc218af..ffb79a4 100644<br>
--- a/src/waffle/glx/glx_context.c<br>
+++ b/src/waffle/glx/glx_context.c<br>
@@ -72,11 +72,38 @@ glx_context_fill_attrib_list(struct glx_config *config,<br>
     struct wcore_config_attrs *attrs = &config->wcore.attrs;<br>
     int i = 0;<br>
<br>
-    attrib_list[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;<br>
-    attrib_list[i++] = attrs->context_major_version;<br>
-<br>
-    attrib_list[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;<br>
-    attrib_list[i++] = attrs->context_minor_version;<br>
+    // As a workaround for NVidia, do not specify<br>
+    // GLX_CONTEXT_MAJOR_VERSION_ARB and GLX_CONTEXT_MINOR_VERSION_ARB in the<br>
+    // call to glXCreateContextAttribsARB if the user requested an OpenGL<br>
+    // context of unspecified version or if the user explicitly requested an<br>
+    // OpenGL 1.0 context.<br>
+    //<br>
+    // Calling glXCreateContextAttribARB with MAJOR=1 and MINOR=0, according<br>
+    // to the spec, is equivalent to calling it with MAJOR and MINOR<br>
+    // unspecified.  From the GLX_ARB_create_context spec:<br>
+    //<br>
+    //     If an attribute is not specified in <attrib_list>,<br>
+    //     then the default value specified below is used instead.<br>
+    //<br>
+    //     The default values for GLX_CONTEXT_MAJOR_VERSION_ARB and<br>
+    //     GLX_CONTEXT_MINOR_VERSION_ARB are 1 and 0 respectively. In this<br>
+    //     case, implementations will typically return the most recent version<br>
+    //     of OpenGL they support which is backwards compatible with OpenGL 1.0<br>
+    //     (e.g. 3.0, 3.1 + GL_ARB_compatibility, or 3.2 compatibility profile)<br>
+    //<br>
+    // However, NVidia's libGL, circa 2012-12-19, is not compliant. Calling<br>
+    // glXCreateContextAttribsARB with MAJOR=1 and MINOR=0 returns an OpenGL<br>
+    // 2.1 context. Calling it with MAJOR and MINOR unspecified returns<br>
+    // a context of the latest supported OpenGL version.<br>
+    if (attrs->context_api == WAFFLE_CONTEXT_OPENGL &&<br>
+        attrs->context_full_version != 10)<br>
+    {<br>
+        attrib_list[i++] = GLX_CONTEXT_MAJOR_VERSION_ARB;<br>
+        attrib_list[i++] = attrs->context_major_version;<br>
+<br>
+        attrib_list[i++] = GLX_CONTEXT_MINOR_VERSION_ARB;<br>
+        attrib_list[i++] = attrs->context_minor_version;<br>
+    }<br>
<br>
     switch (attrs->context_api) {<br>
         case WAFFLE_CONTEXT_OPENGL:<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.7<br>
<br>
</font></span></blockquote></div><br></div></div>