From 19231291e67f8aeefcf29bbb8e269615ea0a819d Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Mon, 18 Oct 2010 10:49:04 +0000 Subject: Improved portability to diverse Mac O X versions git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7724 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Gl_Choice.cxx | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/Fl_Gl_Choice.cxx b/src/Fl_Gl_Choice.cxx index 7d3a238ab..7dd4bc947 100644 --- a/src/Fl_Gl_Choice.cxx +++ b/src/Fl_Gl_Choice.cxx @@ -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 @@ -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 -- cgit v1.2.3