在 OSX 上将项目升级到 OpenGL 4.1 - 使用 NSOpenGLProfileVersion4_1Core 会使渲染变慢

Upgrading project to OpenGL 4.1 on OSX - Using NSOpenGLProfileVersion4_1Core makes rendering slow

我正在尝试将 OSX OpenGL 项目更新为 OpenGL 4.1。我的着色器使用 #version 410 并且一切正常并且非常活泼。今天我注意到 4.1 有一个新的 NSOpenGLPFAOpenGLProfile 值,所以我将像素格式配置文件从 NSOpenGLProfileVersion3_2Core 更新为 NSOpenGLProfileVersion4_1Core,现在渲染是 疯狂 减缓。我的像素格式初始化代码如下所示:

NSOpenGLPixelFormatAttribute attrs[] =
{
    NSOpenGLPFADoubleBuffer,
    NSOpenGLPFADepthSize, 24,
    NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion4_1Core,
    0
};

NSOpenGLPixelFormat *pf =
    [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];

任何人都知道为什么这会慢得多 - 还有什么我需要更新的吗?

在 Mavericks 上使用 NSOpenGLProfileVersion4_1Core 会导致完整的软件回退。这不是 Yosemite.

上的问题

使用 NSOpenGLPFAOpenGLProfile,NSOpenGLProfileVersion3_2Core 无论哪种情况(10.9 或 10.10)都将实际启用 OpenGL 和 GLSL 4.1 版。我自己在这两种情况下都使用过它。

NSOpenGLProfileVersion3_2Core 是用词不当。它实际上启用了可用的最新版本,不一定是 3.2。

使用 prepareOpenGL 方法中的以下调用检查是否为真:

NSLog(@"OpenGL version = %s", glGetString(GL_VERSION));
NSLog(@"GLSL version = %s", glGetString(GL_SHADING_LANGUAGE_VERSION));