From ac1bbc2f0e53963d4c1bcf405ae2941677e66441 Mon Sep 17 00:00:00 2001 From: ikits Date: Sun, 1 Feb 2004 22:27:31 +0000 Subject: [PATCH] fixed glxew bugs git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@212 783a27ee-832a-0410-bc00-9f386506c6dd --- auto/src/glew_gl.c | 6 +++--- auto/src/glew_glx.c | 11 ++++++----- auto/src/glew_post.h | 2 +- auto/src/glew_wgl.c | 6 +++--- auto/src/glewinfo_post.c | 4 ++-- auto/src/glxew_post.h | 2 +- auto/src/glxew_pre.h | 6 ++---- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/auto/src/glew_gl.c b/auto/src/glew_gl.c index c32c579..c74f68f 100644 --- a/auto/src/glew_gl.c +++ b/auto/src/glew_gl.c @@ -32,18 +32,18 @@ static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n) * other extension names. Could use strtok() but the constant * string returned by glGetString might be in read-only memory. */ -GLboolean glewGetExtension (const GLubyte* name) +GLboolean glewGetExtension (const char* name) { GLubyte* p; GLubyte* end; - GLuint len = _glewStrLen(name); + GLuint len = _glewStrLen((const GLubyte*)name); p = (GLubyte*)glGetString(GL_EXTENSIONS); if (0 == p) return GL_FALSE; end = p + _glewStrLen(p); while (p < end) { GLuint n = _glewStrCLen(p, ' '); - if (len == n && _glewStrSame(name, p, n)) return GL_TRUE; + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; p += n+1; } return GL_FALSE; diff --git a/auto/src/glew_glx.c b/auto/src/glew_glx.c index db4ca5c..c6e3ef2 100644 --- a/auto/src/glew_glx.c +++ b/auto/src/glew_glx.c @@ -3,19 +3,19 @@ #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */ -GLboolean glxewGetExtension (const GLubyte* name) +GLboolean glxewGetExtension (const char* name) { GLubyte* p; GLubyte* end; - GLuint len = _glewStrLen(name); - if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; - p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); + GLuint len = _glewStrLen((const GLubyte*)name); + if (glXQueryExtensionsString == NULL || glxewDefaultContext->__glewXGetCurrentDisplay == NULL) return GL_FALSE; + p = (GLubyte*)glXQueryExtensionsString(glxewDefaultContext->__glewXGetCurrentDisplay(), DefaultScreen(glxewDefaultContext->__glewXGetCurrentDisplay())); if (0 == p) return GL_FALSE; end = p + _glewStrLen(p); while (p < end) { GLuint n = _glewStrCLen(p, ' '); - if (len == n && _glewStrSame(name, p, n)) return GL_TRUE; + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; p += n+1; } return GL_FALSE; @@ -26,6 +26,7 @@ GLenum glxewContextInit (GLXEWContext* ctx) int major, minor; /* initialize core GLX 1.2 */ if (_glewInit_GLX_VERSION_1_2(ctx)) return GLEW_ERROR_GLX_VERSION_11_ONLY; + glxewDefaultContext->__glewXGetCurrentDisplay = ctx->__glewXGetCurrentDisplay; /* query GLX version */ glXQueryVersion(glXGetCurrentDisplay(), &major, &minor); ctx->__GLXEW_VERSION_1_0 = GL_FALSE; diff --git a/auto/src/glew_post.h b/auto/src/glew_post.h index 0c5f169..3964bac 100644 --- a/auto/src/glew_post.h +++ b/auto/src/glew_post.h @@ -25,7 +25,7 @@ GLEWAPI GLboolean glewExperimental; GLEWAPI GLenum glewInit (); GLEWAPI GLenum glewContextInit (GLEWContext* ctx); -GLEWAPI GLboolean glewGetExtension (const GLubyte* name); +GLEWAPI GLboolean glewGetExtension (const char* name); GLEWAPI const GLubyte* glewGetErrorString (GLenum error); GLEWAPI const GLubyte* glewGetString (GLenum name); diff --git a/auto/src/glew_wgl.c b/auto/src/glew_wgl.c index b596a6d..756574f 100644 --- a/auto/src/glew_wgl.c +++ b/auto/src/glew_wgl.c @@ -5,11 +5,11 @@ #ifdef _WIN32 -GLboolean wglewGetExtension (const GLubyte* name) +GLboolean wglewGetExtension (const char* name) { GLubyte* p; GLubyte* end; - GLuint len = _glewStrLen(name); + GLuint len = _glewStrLen((const GLubyte*)name); if (wglewDefaultContext->__wglewGetExtensionsStringARB == NULL) if (wglewDefaultContext->__wglewGetExtensionsStringEXT == NULL) return GL_FALSE; @@ -22,7 +22,7 @@ GLboolean wglewGetExtension (const GLubyte* name) while (p < end) { GLuint n = _glewStrCLen(p, ' '); - if (len == n && _glewStrSame(name, p, n)) return GL_TRUE; + if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE; p += n+1; } return GL_FALSE; diff --git a/auto/src/glewinfo_post.c b/auto/src/glewinfo_post.c index 69850d7..5b33165 100644 --- a/auto/src/glewinfo_post.c +++ b/auto/src/glewinfo_post.c @@ -44,9 +44,9 @@ int main (int argc, char** argv) fprintf(f, "---------------------------\n\n"); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); #ifdef _WIN32 - fprintf(f, "Reporting capabilities of PixelFormat %d\n", visual); + fprintf(f, "Reporting capabilities of pixelformat %d\n", visual); #else - fprintf(f, "Reporting capabilities of Display %s, Visual %d\n", + fprintf(f, "Reporting capabilities of display %s, visual 0x%x\n", display == NULL ? getenv("DISPLAY") : display, visual); #endif fprintf(f, "Running on a %s from %s\n", diff --git a/auto/src/glxew_post.h b/auto/src/glxew_post.h index ecbf8a0..31aec4a 100644 --- a/auto/src/glxew_post.h +++ b/auto/src/glxew_post.h @@ -11,7 +11,7 @@ extern GLXEWContext* glxewGetContext(); #endif /* GLEW_MX */ extern GLenum glxewContextInit (GLXEWContext* ctx); -extern GLboolean glxewGetExtension (const GLubyte* name); +extern GLboolean glxewGetExtension (const char* name); #ifdef __cplusplus } diff --git a/auto/src/glxew_pre.h b/auto/src/glxew_pre.h index d0e7966..2d3deb4 100644 --- a/auto/src/glxew_pre.h +++ b/auto/src/glxew_pre.h @@ -119,8 +119,7 @@ extern void glXWaitX (void); extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); extern void glXUseXFont (Font font, int first, int count, int listBase); -GLEWAPI GLboolean GLXEW_VERSION_1_0; -#define glxew_VERSION_1_0 GLXEW_VERSION_1_0 +#define GLXEW_VERSION_1_0 GLXEW_GET_CONTEXT(__GLXEW_VERSION_1_0) #endif /* GLX_VERSION_1_0 */ @@ -137,8 +136,7 @@ extern const char* glXQueryExtensionsString (Display *dpy, int screen); extern const char* glXGetClientString (Display *dpy, int name); extern const char* glXQueryServerString (Display *dpy, int screen, int name); -GLEWAPI GLboolean GLXEW_VERSION_1_1; -#define glxew_VERSION_1_1 GLXEW_VERSION_1_1 +#define GLXEW_VERSION_1_1 GLXEW_GET_CONTEXT(__GLXEW_VERSION_1_1) #endif /* GLX_VERSION_1_1 */