Mike Hays
Mike Hays

Reputation: 93

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

I'm trying to update an OSX OpenGL project to OpenGL 4.1. My shaders use #version 410 and everything is working and pretty snappy. Today I noticed that there's a new NSOpenGLPFAOpenGLProfile value for 4.1, so I updated the pixel format profile from NSOpenGLProfileVersion3_2Core to NSOpenGLProfileVersion4_1Core, and now rendering is insanely slow. My pixel format initialization code looks like this:

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

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

Anybody know why this would be so much slower - Is there something else I need to update?

Upvotes: 3

Views: 963

Answers (2)

jwlaughton
jwlaughton

Reputation: 925

Using NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core in either case (10.9 or 10.10) will actually enable OpenGL and GLSL versions 4.1. I've used it myself in both cases.

NSOpenGLProfileVersion3_2Core is a misnomer. It actually enables the latest version available, not necessarily 3.2.

Check this to be true with the following calls in your prepareOpenGL method:

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

Upvotes: 0

Mike Hays
Mike Hays

Reputation: 93

Using NSOpenGLProfileVersion4_1Core on Mavericks causes a full software fallback. This is not an issue on Yosemite.

Upvotes: 2

Related Questions