4

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.

Community
  • 1
  • 1
Howard
  • 87
  • 1
  • 12
  • Is this a programming question or a user question? – rmaddy Nov 03 '15 at 03:42
  • I suppose its not exactly a programing questions. Its more of a gernal developing question, use to trouble shoot graphics problems on a mac. I'm thinking that this may be preventing refresh problems for how graphics draw on my screen. But i could be way off base. If there is a more appropriate place to post this question I'm more than happy to relocate! – Howard Nov 04 '15 at 04:13

1 Answers1

1

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.

Nox
  • 932
  • 1
  • 9
  • 27
  • Confirmed working on macOS 10.14, but seems this is not working on macOS 10.15 and 11 anymore, I've tried `kCGLCPSwapInterval` / `NSOpenGLCPSwapInterval` / `CVDisplayLink` – vk.edward.li Jul 24 '21 at 12:53
  • 1
    Found out on macOS 10.15 and 11, the actual drawing code including `flushBuffer()` must not be put in `func draw(_ dirtyRect: NSRect)` – vk.edward.li Jul 26 '21 at 14:17
  • @vk.edward.li so is there a solution for macOS 11? – Slbox Nov 09 '22 at 20:21
  • @Slbox the above solution works, as long as you don't put the drawing code inside `func draw(_ dirtyRect: NSRect)` (if my memory serves me right) – vk.edward.li Nov 17 '22 at 20:14