diff --git a/include/GL/glew.h b/include/GL/glew.h index d464a3e..25fb7bc 100644 --- a/include/GL/glew.h +++ b/include/GL/glew.h @@ -19000,6 +19000,17 @@ GLEW_VAR_EXPORT GLboolean __GLEW_WIN_swap_hint; #define GLEW_VERSION_MINOR 3 #define GLEW_VERSION_MICRO 4 +/* ------------------------------------------------------------------------- */ + +/* GLEW version info */ + +/* +VERSION 1.12.0 +VERSION_MAJOR 1 +VERSION_MINOR 12 +VERSION_MICRO 0 +*/ + /* API */ #ifdef GLEW_MX diff --git a/src/glewinfo.c b/src/glewinfo.c index 5ba5dff..61a67d9 100644 --- a/src/glewinfo.c +++ b/src/glewinfo.c @@ -11257,26 +11257,34 @@ void glewDestroyContext () #elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX) -#include +#include +#include -AGLContext ctx, octx; +CGLContextObj ctx, octx; GLboolean glewCreateContext () { - int attrib[] = { AGL_RGBA, AGL_NONE }; - AGLPixelFormat pf; - /*int major, minor; - SetPortWindowPort(wnd); - aglGetVersion(&major, &minor); - fprintf(stderr, "GL %d.%d\n", major, minor);*/ - pf = aglChoosePixelFormat(NULL, 0, attrib); - if (NULL == pf) return GL_TRUE; - ctx = aglCreateContext(pf, NULL); - if (NULL == ctx || AGL_NO_ERROR != aglGetError()) return GL_TRUE; - aglDestroyPixelFormat(pf); - /*aglSetDrawable(ctx, GetWindowPort(wnd));*/ - octx = aglGetCurrentContext(); - if (GL_FALSE == aglSetCurrentContext(ctx)) return GL_TRUE; + const CGLPixelFormatAttribute attrib[4] = + { + kCGLPFAAccelerated, /* No software rendering */ +#if 0 + kCGLPFAOpenGLProfile, /* OSX 10.7 Lion onwards */ + (CGLPixelFormatAttribute) kCGLOGLPVersion_3_2_Core, /* 3.2 Core Context */ +#endif + 0 + }; + CGLPixelFormatObj pf; + GLint npix; + CGLError error; + + error = CGLChoosePixelFormat(attrib, &pf, &npix); + if (error) return GL_TRUE; + error = CGLCreateContext(pf, NULL, &ctx); + if (error) return GL_TRUE; + CGLReleasePixelFormat(pf); + octx = CGLGetCurrentContext(); + error = CGLSetCurrentContext(ctx); + if (error) return GL_TRUE; /* Needed for Regal on the Mac */ #if defined(GLEW_REGAL) && defined(__APPLE__) RegalMakeCurrent(ctx); @@ -11286,8 +11294,8 @@ GLboolean glewCreateContext () void glewDestroyContext () { - aglSetCurrentContext(octx); - if (NULL != ctx) aglDestroyContext(ctx); + CGLSetCurrentContext(octx); + CGLReleaseContext(ctx); } /* ------------------------------------------------------------------------ */