简体   繁体   中英

Cocoa OpenGL unlocked framerate

I want to be able to run my game without a locked framerate (currently 60 fps). The only way that I have found to run the animation is with a NSTimer. Is there a way to have an unrestricted framerate in Cocoa. If so, a link or a code snippet would help greatly.

If you really want to do this, you might need to use the CGL interface. In a valid GL context, CGLGetCurrentContext returns an (opaque) context object. CGLSetParameter can be used to set a value for the kCGLCPSwapInterval parameter. A value of (0) disables waiting for vsync.

This enabled me to get around ~700 frames per second on my MacBook Pro

It is not permanent either, perfect for testing/benchmarking.

Source

The Quartz debugger in Xcode 11 (version 4.2) moved this to:

Tools->Quartz Debug Settings->Enable Vertical Sync

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM