Merge https://github.com/nigels-com/glew.git into master HEAD at Fri Aug 7 17:44:16 GMT 2015

This commit is contained in:
omniavinco 2015-08-08 02:44:16 +09:00
commit 902171e1f3
11 changed files with 38 additions and 40 deletions

View File

@ -12,7 +12,11 @@ GLboolean glxewGetExtension (const char* name)
return _glewSearchExtension(name, start, end);
}
#ifdef GLEW_MX
GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
#else
GLenum glxewInit (GLXEW_CONTEXT_ARG_DEF_LIST)
#endif
{
int major, minor;
const GLubyte* extStart;

View File

@ -34,21 +34,15 @@ GLboolean glewExperimental = GL_FALSE;
#if !defined(GLEW_MX)
#if defined(_WIN32)
extern GLenum GLEWAPIENTRY wglewContextInit (void);
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX))
extern GLenum GLEWAPIENTRY glxewContextInit (void);
#endif /* _WIN32 */
GLenum GLEWAPIENTRY glewInit (void)
{
GLenum r;
r = glewContextInit();
if ( r != 0 ) return r;
#if defined(_WIN32)
return wglewContextInit();
return wglewInit();
#elif !defined(__ANDROID__) && !defined(__native_client__) && !defined(__HAIKU__) && (!defined(__APPLE__) || defined(GLEW_APPLE_GLX)) /* _UNIX */
return glxewContextInit();
return glxewInit();
#else
return r;
#endif /* _WIN32 */

View File

@ -20,7 +20,11 @@ GLboolean GLEWAPIENTRY wglewGetExtension (const char* name)
return _glewSearchExtension(name, start, end);
}
#ifdef GLEW_MX
GLenum GLEWAPIENTRY wglewContextInit (WGLEW_CONTEXT_ARG_DEF_LIST)
#else
GLenum GLEWAPIENTRY wglewInit (WGLEW_CONTEXT_ARG_DEF_LIST)
#endif
{
GLboolean crippled;
const GLubyte* extStart;

View File

@ -195,7 +195,7 @@ GLboolean glewCreateContext (struct createParams* params)
int contextAttrs[20];
int i;
wglewContextInit();
wglewInit();
/* Intel HD 3000 has WGL_ARB_create_context, but not WGL_ARB_create_context_profile */
if (!wglewGetExtension("WGL_ARB_create_context"))
@ -368,7 +368,7 @@ GLboolean glewCreateContext (struct createParams *params)
int contextAttrs[20];
int nelems, i;
glxewContextInit();
glxewInit();
if (!glxewGetExtension("GLX_ARB_create_context"))
return GL_TRUE;

View File

@ -14,14 +14,12 @@ GLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const GLXEWContext *ctx,
#else /* GLEW_MX */
GLEWAPI GLenum GLEWAPIENTRY glxewContextInit ();
GLEWAPI GLboolean GLEWAPIENTRY glxewContextIsSupported (const char *name);
GLEWAPI GLenum GLEWAPIENTRY glxewInit ();
GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);
#define GLXEW_GET_VAR(x) (*(const GLboolean*)&x)
#define GLXEW_GET_FUN(x) x
GLEWAPI GLboolean GLEWAPIENTRY glxewIsSupported (const char *name);
#endif /* GLEW_MX */
GLEWAPI GLboolean GLEWAPIENTRY glxewGetExtension (const char *name);

View File

@ -14,13 +14,12 @@ GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const WGLEWContext *ctx,
#else /* GLEW_MX */
GLEWAPI GLenum GLEWAPIENTRY wglewInit ();
GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);
#define WGLEW_GET_VAR(x) (*(const GLboolean*)&x)
#define WGLEW_GET_FUN(x) x
GLEWAPI GLenum GLEWAPIENTRY wglewContextInit ();
GLEWAPI GLboolean GLEWAPIENTRY wglewContextIsSupported (const char *name);
GLEWAPI GLboolean GLEWAPIENTRY wglewIsSupported (const char *name);
#endif /* GLEW_MX */
GLEWAPI GLboolean GLEWAPIENTRY wglewGetExtension (const char *name);

View File

@ -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 =

View File

@ -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 =

View File

@ -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

View File

@ -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 =

View File

@ -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);
}
/* ------------------------------------------------------------------------ */