【问题标题】:setWantsBestResolutionOpenGLSurface and flickering with multiple overlaying windows on retinasetWantsBestResolutionOpenGLSurface 和视网膜上的多个重叠窗口闪烁
【发布时间】:2026-02-14 09:25:02
【问题描述】:
我正在使用 setWantsBestResolutionOpenGLSurface 来享受视网膜上的高 DPI。现在一切正常,除了如果我有多个相互重叠的窗口(这些是 AU 插件),部分插件中的绘图会随机绘制在前景窗口上,从而导致严重闪烁。当不使用 setWantsBestResolutionOpenGLSurface 时它不会这样做,但代码几乎完全相同。
【问题讨论】:
标签:
macos
opengl
retina-display
flicker
【解决方案1】:
所以这是解决方案:
// Synchronize buffer swaps with vertical refresh rate.
GLint swapInt = 1;
[[self openGLContext] makeCurrentContext];
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
有趣的事实:没有视网膜就不会这样做,而且苹果文档中没有提到这一点,所以我只能假设这是另一个 OSX 错误。