Cocoa OpenGL unlocked framerate

老子叫甜甜 提交于 2019-12-01 08:40:34

问题


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.


回答1:


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.




回答2:


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

  • Download Graphics Tools for Xcode - Late August 2014
  • Install or just mount Graphic Tools
  • Open Quartz Debug
  • Go to Tools -> Show Beam Sync Tools
  • Select Disable Beam Synchronization

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

Source



来源:https://stackoverflow.com/questions/10866561/cocoa-opengl-unlocked-framerate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!