[Xquartz-changes] [265] AppleSGLX/trunk/apple_xgl_api_stereo.c

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 26 08:53:21 PST 2009


Revision: 265
          http://trac.macosforge.org/projects/xquartz/changeset/265
Author:   gstaplin at apple.com
Date:     2009-02-26 08:53:21 -0800 (Thu, 26 Feb 2009)
Log Message:
-----------
Fix an issue with glDrawBuffer that may solve a Pymol problem.

The GL_BACK was being translated to a GL_BACK_LEFT and
GL_BACK_RIGHT correctly, however the GL_FRONT should also be
translated to GL_FRONT_LEFT and GL_FRONT_RIGHT, because
glDrawBuffers (which the glDrawBuffer calls) doesn't accept
GL_FRONT!

So this was producing errors, and most code doesn't call
glGetError, but should, so that's why this went unnoticed.

I suspect some video cards handle the error differently, and
that may be why this occurred only with some video drivers.

This was found during usage of the OpenGL Profiler, which
as I understand it didn't work correctly with the old libGL.
It seems to work fine with AppleSGLX though.

So hurray!  It may fix Pymol!

Modified Paths:
--------------
    AppleSGLX/trunk/apple_xgl_api_stereo.c

Modified: AppleSGLX/trunk/apple_xgl_api_stereo.c
===================================================================
--- AppleSGLX/trunk/apple_xgl_api_stereo.c	2009-02-26 15:45:08 UTC (rev 264)
+++ AppleSGLX/trunk/apple_xgl_api_stereo.c	2009-02-26 16:53:21 UTC (rev 265)
@@ -5,12 +5,20 @@
 void glDrawBuffer(GLenum mode) {
     GLenum buf[2];
     GLsizei n = 0;
-	     
-    if(GL_BACK == mode) {
+	
+    switch(mode) {
+    case GL_BACK:
 	buf[0] = GL_BACK_LEFT;
 	buf[1] = GL_BACK_RIGHT;
 	n = 2;
-    } else {
+	break;
+    case GL_FRONT:
+	buf[0] = GL_FRONT_LEFT;
+	buf[1] = GL_FRONT_RIGHT;
+	n = 2;
+	break;
+	
+    default:
 	buf[0] = mode;
 	n = 1;
     }
@@ -23,7 +31,7 @@
     GLenum newbuf[n + 2];
     GLsizei i, outi = 0;
     bool have_back = false;
-    
+        
     for(i = 0; i < n; ++i) {
 	if(GL_BACK == bufs[i]) {
 	    have_back = true;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20090226/fd71a863/attachment.html>


More information about the Xquartz-changes mailing list