admin管理员组

文章数量:1122832

I’m trying to define the frame rate for rendering with a GLKView or MTKView on my iPhone 15 Pro Max, which supports a 120Hz refresh rate (ProMotion). However, I’m having difficulty achieving anything higher than 60 FPS. Here’s what I’ve done so far:

For GLKView: By default, drawRect is called at a maximum rate of 60 FPS, despite the device being capable of 120 FPS.

For MTKView: I’ve set enableSetNeedsDisplay to true and manually call setNeedsDisplay every 8ms, expecting it to render at around 120 FPS. However, the frame rate remains capped at 60 FPS.

How can I configure either GLKView or MTKView to render at the device's full 120Hz capability? Are there additional settings or properties (e.g., related to CADisplayLink or preferredFramesPerSecond) that I need to adjust for high refresh rates?

Any insights or guidance would be greatly appreciated!

I’m trying to define the frame rate for rendering with a GLKView or MTKView on my iPhone 15 Pro Max, which supports a 120Hz refresh rate (ProMotion). However, I’m having difficulty achieving anything higher than 60 FPS. Here’s what I’ve done so far:

For GLKView: By default, drawRect is called at a maximum rate of 60 FPS, despite the device being capable of 120 FPS.

For MTKView: I’ve set enableSetNeedsDisplay to true and manually call setNeedsDisplay every 8ms, expecting it to render at around 120 FPS. However, the frame rate remains capped at 60 FPS.

How can I configure either GLKView or MTKView to render at the device's full 120Hz capability? Are there additional settings or properties (e.g., related to CADisplayLink or preferredFramesPerSecond) that I need to adjust for high refresh rates?

Any insights or guidance would be greatly appreciated!

Share Improve this question asked Nov 21, 2024 at 21:21 zeuszeus 13.3k16 gold badges85 silver badges233 bronze badges 2
  • Enable faster ProMotion refresh rates – Hamid Yusifli Commented Nov 21, 2024 at 21:30
  • Yes but what do do exactly ? i did everything without success – zeus Commented Nov 21, 2024 at 21:44
Add a comment  | 

1 Answer 1

Reset to default 1

I found, i need to do :

let displayLink = CADisplayLink(target: self, selector: #selector(render))
if #available(iOS 15.0, *) {
    displayLink.preferredFrameRateRange = CAFrameRateRange(minimum: 120, maximum: 120, preferred: 120)
} else {
    displayLink.preferredFramesPerSecond = 60
}
displayLink.add(to: .current, forMode: .default)

本文标签: iosHow to Set the Frame Rate for GLKView or MTKView on iPhone 15 Pro Max (120Hz Display)Stack Overflow