Search code examples
xcodegraphicsosx-elcapitan

How to disable Vsync on mac os x 10.11 El Capitan


There is a solution here: How to disable vsync on macOS

However This only works for 10.10 and older, and Xcode 6 and older. It seems that the quartz debug that comes with Xcode 7 does not have options to turn of vysnc (beam sync).

Any help would be greatly appreciated. I'm running a Mac Book pro 13' if that matters.


Solution

  • After YEARS looking for a workaround, this is what worked for me - I've added that piece of code at the start of my render loop and was finally have unsynchronize framerate:

    #ifdef __APPLE__
    GLint                       sync = 0;
    CGLContextObj               ctx = CGLGetCurrentContext();
    
    CGLSetParameter(ctx, kCGLCPSwapInterval, &sync);
    #endif
    

    Don't forget to include <OpenGL/gl.h>

    It's not the nicest solution but it's actually the only one I found that work like a charm.