(Apple/OSX) Add HAVE_NSOPENGL ifdefs

This commit is contained in:
Twinaphex 2014-11-18 01:44:19 +01:00
parent e27ee8226b
commit b92838895a
1 changed files with 12 additions and 8 deletions

View File

@ -74,9 +74,7 @@ static void apple_gfx_ctx_update(void)
{ {
#ifdef OSX #ifdef OSX
#ifdef MAC_OS_X_VERSION_10_7 #ifdef MAC_OS_X_VERSION_10_7
CGLContextObj context = (CGLContextObj)g_context.CGLContextObj; CGLUpdateContext(g_context.CGLContextObj);
if (context)
CGLUpdateContext(context);
#else #else
[g_context update]; [g_context update];
#endif #endif
@ -183,7 +181,12 @@ static void apple_gfx_ctx_swap_interval(void *data, unsigned interval)
g_fast_forward_skips = interval ? 0 : 3; g_fast_forward_skips = interval ? 0 : 3;
#elif defined(OSX) #elif defined(OSX)
GLint value = interval ? 1 : 0; GLint value = interval ? 1 : 0;
#ifdef HAVE_NSOPENGL
[g_context setValues:&value forParameter:NSOpenGLCPSwapInterval]; [g_context setValues:&value forParameter:NSOpenGLCPSwapInterval];
#else
CGLSetParameter(g_context.CGLContextObj, kCGLCPSwapInterval, &value);
#endif
#endif #endif
} }
@ -275,13 +278,14 @@ static void apple_gfx_ctx_swap_buffers(void *data)
return; return;
#ifdef OSX #ifdef OSX
#ifdef MAC_OS_X_VERSION_10_6
CGLContextObj context = (CGLContextObj)g_context.CGLContextObj; #ifdef HAVE_NSOPENGL
if (context)
CGLFlushDrawable(context);
#else
[g_context flushBuffer]; [g_context flushBuffer];
#else
if (g_context.CGLContextObj)
CGLFlushDrawable(g_context.CGLContextObj);
#endif #endif
#else #else
[g_view display]; [g_view display];
#endif #endif