Skip to content

Commit

Permalink
Improved portability to diverse Mac O X versions
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7724 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed Oct 18, 2010
1 parent 0d6987a commit 1923129
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions src/Fl_Gl_Choice.cxx
Expand Up @@ -349,11 +349,21 @@ void fl_set_gl_context(Fl_Window* w, GLContext context) {
aglSetInteger( context, AGL_BUFFER_RECT, rect );
aglEnable( context, AGL_BUFFER_RECT );
}
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
aglSetWindowRef(context, MACwindowRef(w) );
# else
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
# endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
#if __LP64__
// 64 bit version
aglSetWindowRef(context, MACwindowRef(w) );
#else
// 32 bit version >= 10.5
if (aglSetWindowRef != NULL)
aglSetWindowRef(context, MACwindowRef(w) );
else
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
#endif
#else
// 32 bit version < 10.5
aglSetDrawable( context, GetWindowPort( MACwindowRef(w) ) );
#endif
aglSetCurrentContext(context);
# else
# error unsupported platform
Expand All @@ -370,12 +380,13 @@ void fl_no_gl_context() {
wglMakeCurrent(0, 0);
# elif defined(__APPLE_QUARTZ__)
// warning: the Quartz version should probably use Core GL (CGL) instead of AGL
AGLContext ctx = aglGetCurrentContext();
# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (ctx) aglSetWindowRef(ctx, NULL);
# else
if (ctx) aglSetDrawable(ctx, NULL);
# endif
AGLContext ctx = aglGetCurrentContext();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (aglSetWindowRef != NULL)
{ if(ctx) aglSetWindowRef(ctx, NULL ); }
else
#endif
if(ctx) aglSetDrawable( ctx, NULL );
aglSetCurrentContext(0);
# else
# error unsupported platform
Expand Down

0 comments on commit 1923129

Please sign in to comment.