diff --git a/src/igl/opengl/macos/Context.mm b/src/igl/opengl/macos/Context.mm index 84558abc01..941270aef8 100644 --- a/src/igl/opengl/macos/Context.mm +++ b/src/igl/opengl/macos/Context.mm @@ -40,6 +40,29 @@ if (pixelFormat) { format = pixelFormat; } + } else if (api == igl::opengl::RenderingAPI::GL) { + // Copied from preferredPixelFormat, with NSOpenGLProfileVersion4_1Core added + static NSOpenGLPixelFormatAttribute attributes[] = { + NSOpenGLPFAWindow, + NSOpenGLPFAAccelerated, + NSOpenGLPFADoubleBuffer, + NSOpenGLPFAColorSize, + 24, + NSOpenGLPFAAlphaSize, + 8, + NSOpenGLPFADepthSize, + 24, + NSOpenGLPFAStencilSize, + 8, + 0, + NSOpenGLPFAOpenGLProfile, + NSOpenGLProfileVersion4_1Core, + }; + auto pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; + IGL_DEBUG_ASSERT(pixelFormat, "Requested attributes not supported"); + if (pixelFormat) { + format = pixelFormat; + } } return [[NSOpenGLContext alloc] initWithFormat:format shareContext:nil]; }