mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-30 08:44:19 -04:00
cocoa: allow getting a GL 3.2+ context on macOS 10.7+ using gl-version
This commit is contained in:
parent
6faaabe034
commit
061e0c4862
@ -24,6 +24,10 @@
|
||||
#define kCGLRendererIDMatchingMask 0x00FE7F00
|
||||
#endif
|
||||
|
||||
#ifndef NSAppKitVersionNumber10_7
|
||||
#define NSAppKitVersionNumber10_7 1138
|
||||
#endif
|
||||
|
||||
TypeHandle CocoaGraphicsStateGuardian::_type_handle;
|
||||
|
||||
/**
|
||||
@ -207,7 +211,8 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
||||
attribs.push_back(NSOpenGLPFAAccelerated);
|
||||
}
|
||||
|
||||
attribs.push_back(NSOpenGLPFAWindow);
|
||||
// This seems to cause getting a 3.2+ context to fail.
|
||||
//attribs.push_back(NSOpenGLPFAWindow);
|
||||
|
||||
if (need_pbuffer) {
|
||||
attribs.push_back(NSOpenGLPFAPixelBuffer);
|
||||
@ -217,6 +222,16 @@ choose_pixel_format(const FrameBufferProperties &properties,
|
||||
attribs.push_back(NSOpenGLPFAScreenMask);
|
||||
attribs.push_back(CGDisplayIDToOpenGLDisplayMask(display));
|
||||
|
||||
// Set OpenGL version if a minimum was requested.
|
||||
if (gl_version.size() >= 1 && NSAppKitVersionNumber >= NSAppKitVersionNumber10_7) {
|
||||
//NB. There is also NSOpenGLProfileVersion4_1Core, but this seems to cause
|
||||
// a software implementation to be selected on my mac mini running 10.11.
|
||||
if (gl_version[0] >= 4 || (gl_version.size() >= 2 && gl_version[0] == 3 && gl_version[1] >= 2)) {
|
||||
attribs.push_back((NSOpenGLPixelFormatAttribute)99); // NSOpenGLPFAOpenGLProfile
|
||||
attribs.push_back((NSOpenGLPixelFormatAttribute)0x3200); // NSOpenGLProfileVersion3_2Core
|
||||
}
|
||||
}
|
||||
|
||||
// End of the array
|
||||
attribs.push_back((NSOpenGLPixelFormatAttribute)0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user