Skip to content

Commit

Permalink
Create OpenGL 4.1 context by default
Browse files Browse the repository at this point in the history
Reviewed By: ChristianK275, rokuz

Differential Revision: D66830722

fbshipit-source-id: 333573ac109a095d50a80b90330b2057f2aece93
  • Loading branch information
Shayan Javed authored and facebook-github-bot committed Dec 6, 2024
1 parent c55dd18 commit 75205ce
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/igl/opengl/macos/Context.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 75205ce

Please sign in to comment.