(OSX) Flesh out apple_gfx_ctx_init some more - add 'offline renderer'

flag, add fallback for pre-OSX 10.5, etc.
This commit is contained in:
Twinaphex 2014-11-17 17:51:35 +01:00
parent d87470c597
commit 9459749c79

View File

@ -90,18 +90,30 @@ static bool apple_gfx_ctx_init(void *data)
#ifdef OSX
NSOpenGLPixelFormatAttribute attributes [] = {
NSOpenGLPFADoubleBuffer, // double buffered
NSOpenGLPFAColorSize, 24,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAAllowOfflineRenderers,
NSOpenGLPFADepthSize,
(NSOpenGLPixelFormatAttribute)16, // 16 bit depth buffer
#ifdef MAC_OS_X_VERSION_10_7
(g_major || g_minor) ? NSOpenGLPFAOpenGLProfile : 0,
(g_major << 12) | (g_minor << 8),
#endif
(NSOpenGLPixelFormatAttribute)nil
(NSOpenGLPixelFormatAttribute)0
};
g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
if (g_format == nil)
{
/* NSOpenGLFPAAllowOfflineRenderers is
not supported on this OS version. */
attributes[3] = (NSOpenGLPixelFormatAttribute)0;
g_format = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
}
#endif
if (g_use_hw_ctx)
{
//g_hw_ctx = [[NSOpenGLContext alloc] initWithFormat:g_format shareContext:nil];