src/video/quartz/SDL_QuartzGL.m
branchSDL-1.3
changeset 1656 96c2f89cc7e1
parent 1403 376665398b25
child 1662 782fd950bd46
     1.1 --- a/src/video/quartz/SDL_QuartzGL.m	Thu Apr 27 05:49:51 2006 +0000
     1.2 +++ b/src/video/quartz/SDL_QuartzGL.m	Thu Apr 27 09:09:48 2006 +0000
     1.3 @@ -112,6 +112,10 @@
     1.4          attr[i++] = NSOpenGLPFANoRecovery;
     1.5      }
     1.6  
     1.7 +    if ( this->gl_config.accelerated > 0 ) {
     1.8 +        attr[i++] = NSOpenGLPFAAccelerated;
     1.9 +    }
    1.10 +
    1.11      attr[i++] = NSOpenGLPFAScreenMask;
    1.12      attr[i++] = CGDisplayIDToOpenGLDisplayMask (display_id);
    1.13      attr[i] = 0;
    1.14 @@ -132,6 +136,17 @@
    1.15          return 0;
    1.16      }
    1.17  
    1.18 +    /* Synchronize QZ_GL_SwapBuffers() to vertical retrace.
    1.19 +     * (Apple's documentation is not completely clear about what this setting
    1.20 +     * exactly does, IMHO - for a detailed explanation see
    1.21 +     * http://lists.apple.com/archives/mac-opengl/2006/Jan/msg00080.html )
    1.22 +     */
    1.23 +    if ( this->gl_config.swap_control >= 0 ) {
    1.24 +        long value;
    1.25 +        value = this->gl_config.swap_control;
    1.26 +        [ gl_context setValues: &value forParameter: NSOpenGLCPSwapInterval ];
    1.27 +    }
    1.28 +
    1.29      /*
    1.30       * Wisdom from Apple engineer in reference to UT2003's OpenGL performance:
    1.31       *  "You are blowing a couple of the internal OpenGL function caches. This
    1.32 @@ -231,8 +246,25 @@
    1.33              glGetIntegerv (GL_ALPHA_BITS, &component); bits += component;
    1.34  
    1.35              *value = bits;
    1.36 +            return 0;
    1.37          }
    1.38 -        return 0;
    1.39 +        case SDL_GL_ACCELERATED_VISUAL:
    1.40 +        {
    1.41 +            long val;
    1.42 +	    /* FIXME: How do we get this information here?
    1.43 +            [fmt getValues: &val forAttribute: NSOpenGLPFAAccelerated attr forVirtualScreen: 0];
    1.44 +	    */
    1.45 +	    val = (this->gl_config.accelerated != 0);;
    1.46 +            *value = val;
    1.47 +            return 0;
    1.48 +        }
    1.49 +        case SDL_GL_SWAP_CONTROL:
    1.50 +        {
    1.51 +            long val;
    1.52 +            [ gl_context getValues: &val forParameter: NSOpenGLCPSwapInterval ];
    1.53 +            *value = val;
    1.54 +            return 0;
    1.55 +        }
    1.56      }
    1.57  
    1.58      glGetIntegerv (attr, (GLint *)value);