diff src/video/quartz/SDL_QuartzGL.m @ 1656:96c2f89cc7e1 SDL-1.3

SDL-trunk-1.3-merge-1
author Sam Lantinga <slouken@libsdl.org>
date Thu, 27 Apr 2006 09:09:48 +0000
parents 376665398b25
children 782fd950bd46
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzGL.m	Thu Apr 27 05:49:51 2006 +0000
+++ b/src/video/quartz/SDL_QuartzGL.m	Thu Apr 27 09:09:48 2006 +0000
@@ -112,6 +112,10 @@
         attr[i++] = NSOpenGLPFANoRecovery;
     }
 
+    if ( this->gl_config.accelerated > 0 ) {
+        attr[i++] = NSOpenGLPFAAccelerated;
+    }
+
     attr[i++] = NSOpenGLPFAScreenMask;
     attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id);
     attr[i] = 0;
@@ -132,6 +136,17 @@
         return 0;
     }
 
+    /* Synchronize QZ_GL_SwapBuffers() to vertical retrace.
+     * (Apple's documentation is not completely clear about what this setting
+     * exactly does, IMHO - for a detailed explanation see
+     * http://lists.apple.com/archives/mac-opengl/2006/Jan/msg00080.html )
+     */
+    if ( this->gl_config.swap_control >= 0 ) {
+        long value;
+        value = this->gl_config.swap_control;
+        [ gl_context setValues: &value forParameter: NSOpenGLCPSwapInterval ];
+    }
+
     /*
      * Wisdom from Apple engineer in reference to UT2003's OpenGL performance:
      *  "You are blowing a couple of the internal OpenGL function caches. This
@@ -231,8 +246,25 @@
             glGetIntegerv (GL_ALPHA_BITS, &component); bits += component;
 
             *value = bits;
+            return 0;
         }
-        return 0;
+        case SDL_GL_ACCELERATED_VISUAL:
+        {
+            long val;
+	    /* FIXME: How do we get this information here?
+            [fmt getValues: &val forAttribute: NSOpenGLPFAAccelerated attr forVirtualScreen: 0];
+	    */
+	    val = (this->gl_config.accelerated != 0);;
+            *value = val;
+            return 0;
+        }
+        case SDL_GL_SWAP_CONTROL:
+        {
+            long val;
+            [ gl_context getValues: &val forParameter: NSOpenGLCPSwapInterval ];
+            *value = val;
+            return 0;
+        }
     }
 
     glGetIntegerv (attr, (GLint *)value);