I'm trying to set up a simple OpenGL game on macOS, using an
NSTimer to set up a run loop as explained here. The idea is to create a repeating timer with a very small (~1ms) time interval and rely on vsync to regulate the frame rate.
I'm setting my
NSOpenGLContext swap interval to a value of 1, which should enable vsync. I was under the impression that this would cause
NSOpenGLContext.flushbuffer to block, but this doesn't seem to be the case. My render code is firing off much more frequently than 60 times per second.
The document I linked has been marked as retired, but all the official documentation I've read suggests that it's possible to throttle an
NSTimer loop to the display's refresh rate somehow. I haven't been able to get this working though, and I'm wondering if this approach is no longer viable.
Am I missing something? In a modern project, is it better just to go with a