mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-25 07:15:07 +00:00
No longer using deprecated AGL framework on Mac for visualinfo
This commit is contained in:
parent
e1815b2729
commit
54b537afda
@ -9,7 +9,7 @@ ifneq (undefined, $(origin GLEW_APPLE_GLX))
|
||||
CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX'
|
||||
LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11
|
||||
else
|
||||
LDFLAGS.GL = -framework AGL -framework OpenGL
|
||||
LDFLAGS.GL = -framework OpenGL
|
||||
endif
|
||||
LDFLAGS.STATIC =
|
||||
LDFLAGS.DYNAMIC =
|
||||
|
@ -8,7 +8,7 @@ ifneq (undefined, $(origin GLEW_APPLE_GLX))
|
||||
CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX'
|
||||
LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11
|
||||
else
|
||||
LDFLAGS.GL = -framework AGL -framework OpenGL
|
||||
LDFLAGS.GL = -framework OpenGL
|
||||
endif
|
||||
LDFLAGS.STATIC =
|
||||
LDFLAGS.DYNAMIC =
|
||||
|
@ -12,7 +12,7 @@ ifneq (undefined, $(origin GLEW_APPLE_GLX))
|
||||
CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX'
|
||||
LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11
|
||||
else
|
||||
LDFLAGS.GL = -framework AGL -framework OpenGL
|
||||
LDFLAGS.GL = -framework OpenGL
|
||||
endif
|
||||
LDFLAGS.DYNAMIC =
|
||||
WARN = -Wall -W
|
||||
|
@ -8,7 +8,7 @@ ifneq (undefined, $(origin GLEW_APPLE_GLX))
|
||||
CFLAGS.EXTRA += -I/usr/X11R6/include -D'GLEW_APPLE_GLX'
|
||||
LDFLAGS.GL = -L/usr/X11R6/lib -lGL -lX11
|
||||
else
|
||||
LDFLAGS.GL = -framework AGL -framework OpenGL
|
||||
LDFLAGS.GL = -framework OpenGL
|
||||
endif
|
||||
LDFLAGS.STATIC =
|
||||
LDFLAGS.DYNAMIC =
|
||||
|
@ -37,7 +37,8 @@
|
||||
#if defined(_WIN32)
|
||||
#include <GL/wglew.h>
|
||||
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
|
||||
#include <AGL/agl.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#elif !defined(__HAIKU__)
|
||||
#include <GL/glxew.h>
|
||||
#endif
|
||||
@ -61,7 +62,7 @@ typedef struct GLContextStruct
|
||||
HDC dc;
|
||||
HGLRC rc;
|
||||
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)
|
||||
AGLContext ctx, octx;
|
||||
CGLContextObj ctx, octx;
|
||||
#elif !defined(__HAIKU__)
|
||||
Display* dpy;
|
||||
XVisualInfo* vi;
|
||||
@ -1072,30 +1073,28 @@ void InitContext (GLContext* ctx)
|
||||
|
||||
GLboolean CreateContext (GLContext* ctx)
|
||||
{
|
||||
int attrib[] = { AGL_RGBA, AGL_NONE };
|
||||
AGLPixelFormat pf;
|
||||
CGLPixelFormatAttribute attrib[] = { kCGLPFAAccelerated, 0 };
|
||||
CGLPixelFormatObj pf;
|
||||
GLint npix;
|
||||
CGLError error;
|
||||
/* check input */
|
||||
if (NULL == ctx) return GL_TRUE;
|
||||
/*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->ctx = aglCreateContext(pf, NULL);
|
||||
if (NULL == ctx->ctx || AGL_NO_ERROR != aglGetError()) return GL_TRUE;
|
||||
aglDestroyPixelFormat(pf);
|
||||
/*aglSetDrawable(ctx, GetWindowPort(wnd));*/
|
||||
ctx->octx = aglGetCurrentContext();
|
||||
if (GL_FALSE == aglSetCurrentContext(ctx->ctx)) return GL_TRUE;
|
||||
error = CGLChoosePixelFormat(attrib, &pf, &npix);
|
||||
if (error) return GL_TRUE;
|
||||
error = CGLCreateContext(pf, NULL, &ctx->ctx);
|
||||
if (error) return GL_TRUE;
|
||||
CGLReleasePixelFormat(pf);
|
||||
ctx->octx = CGLGetCurrentContext();
|
||||
error = CGLSetCurrentContext(ctx->ctx);
|
||||
if (error) return GL_TRUE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
void DestroyContext (GLContext* ctx)
|
||||
{
|
||||
if (NULL == ctx) return;
|
||||
aglSetCurrentContext(ctx->octx);
|
||||
if (NULL != ctx->ctx) aglDestroyContext(ctx->ctx);
|
||||
CGLSetCurrentContext(ctx->octx);
|
||||
if (NULL != ctx->ctx) CGLReleaseContext(ctx->ctx);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
Loading…
Reference in New Issue
Block a user