fixed glxew bugs

git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@212 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
ikits 2004-02-01 22:27:31 +00:00
parent 04f2f79b2e
commit ac1bbc2f0e
7 changed files with 18 additions and 19 deletions

View File

@ -32,18 +32,18 @@ static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
* other extension names. Could use strtok() but the constant * other extension names. Could use strtok() but the constant
* string returned by glGetString might be in read-only memory. * string returned by glGetString might be in read-only memory.
*/ */
GLboolean glewGetExtension (const GLubyte* name) GLboolean glewGetExtension (const char* name)
{ {
GLubyte* p; GLubyte* p;
GLubyte* end; GLubyte* end;
GLuint len = _glewStrLen(name); GLuint len = _glewStrLen((const GLubyte*)name);
p = (GLubyte*)glGetString(GL_EXTENSIONS); p = (GLubyte*)glGetString(GL_EXTENSIONS);
if (0 == p) return GL_FALSE; if (0 == p) return GL_FALSE;
end = p + _glewStrLen(p); end = p + _glewStrLen(p);
while (p < end) while (p < end)
{ {
GLuint n = _glewStrCLen(p, ' '); 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; p += n+1;
} }
return GL_FALSE; return GL_FALSE;

View File

@ -3,19 +3,19 @@
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */ #elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
GLboolean glxewGetExtension (const GLubyte* name) GLboolean glxewGetExtension (const char* name)
{ {
GLubyte* p; GLubyte* p;
GLubyte* end; GLubyte* end;
GLuint len = _glewStrLen(name); GLuint len = _glewStrLen((const GLubyte*)name);
if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; if (glXQueryExtensionsString == NULL || glxewDefaultContext->__glewXGetCurrentDisplay == NULL) return GL_FALSE;
p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); p = (GLubyte*)glXQueryExtensionsString(glxewDefaultContext->__glewXGetCurrentDisplay(), DefaultScreen(glxewDefaultContext->__glewXGetCurrentDisplay()));
if (0 == p) return GL_FALSE; if (0 == p) return GL_FALSE;
end = p + _glewStrLen(p); end = p + _glewStrLen(p);
while (p < end) while (p < end)
{ {
GLuint n = _glewStrCLen(p, ' '); 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; p += n+1;
} }
return GL_FALSE; return GL_FALSE;
@ -26,6 +26,7 @@ GLenum glxewContextInit (GLXEWContext* ctx)
int major, minor; int major, minor;
/* initialize core GLX 1.2 */ /* initialize core GLX 1.2 */
if (_glewInit_GLX_VERSION_1_2(ctx)) return GLEW_ERROR_GLX_VERSION_11_ONLY; if (_glewInit_GLX_VERSION_1_2(ctx)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
glxewDefaultContext->__glewXGetCurrentDisplay = ctx->__glewXGetCurrentDisplay;
/* query GLX version */ /* query GLX version */
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor); glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
ctx->__GLXEW_VERSION_1_0 = GL_FALSE; ctx->__GLXEW_VERSION_1_0 = GL_FALSE;

View File

@ -25,7 +25,7 @@ GLEWAPI GLboolean glewExperimental;
GLEWAPI GLenum glewInit (); GLEWAPI GLenum glewInit ();
GLEWAPI GLenum glewContextInit (GLEWContext* ctx); 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* glewGetErrorString (GLenum error);
GLEWAPI const GLubyte* glewGetString (GLenum name); GLEWAPI const GLubyte* glewGetString (GLenum name);

View File

@ -5,11 +5,11 @@
#ifdef _WIN32 #ifdef _WIN32
GLboolean wglewGetExtension (const GLubyte* name) GLboolean wglewGetExtension (const char* name)
{ {
GLubyte* p; GLubyte* p;
GLubyte* end; GLubyte* end;
GLuint len = _glewStrLen(name); GLuint len = _glewStrLen((const GLubyte*)name);
if (wglewDefaultContext->__wglewGetExtensionsStringARB == NULL) if (wglewDefaultContext->__wglewGetExtensionsStringARB == NULL)
if (wglewDefaultContext->__wglewGetExtensionsStringEXT == NULL) if (wglewDefaultContext->__wglewGetExtensionsStringEXT == NULL)
return GL_FALSE; return GL_FALSE;
@ -22,7 +22,7 @@ GLboolean wglewGetExtension (const GLubyte* name)
while (p < end) while (p < end)
{ {
GLuint n = _glewStrCLen(p, ' '); 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; p += n+1;
} }
return GL_FALSE; return GL_FALSE;

View File

@ -44,9 +44,9 @@ int main (int argc, char** argv)
fprintf(f, "---------------------------\n\n"); fprintf(f, "---------------------------\n\n");
fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION)); fprintf(f, "GLEW version %s\n", glewGetString(GLEW_VERSION));
#ifdef _WIN32 #ifdef _WIN32
fprintf(f, "Reporting capabilities of PixelFormat %d\n", visual); fprintf(f, "Reporting capabilities of pixelformat %d\n", visual);
#else #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); display == NULL ? getenv("DISPLAY") : display, visual);
#endif #endif
fprintf(f, "Running on a %s from %s\n", fprintf(f, "Running on a %s from %s\n",

View File

@ -11,7 +11,7 @@ extern GLXEWContext* glxewGetContext();
#endif /* GLEW_MX */ #endif /* GLEW_MX */
extern GLenum glxewContextInit (GLXEWContext* ctx); extern GLenum glxewContextInit (GLXEWContext* ctx);
extern GLboolean glxewGetExtension (const GLubyte* name); extern GLboolean glxewGetExtension (const char* name);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -119,8 +119,7 @@ extern void glXWaitX (void);
extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable); extern void glXSwapBuffers (Display *dpy, GLXDrawable drawable);
extern void glXUseXFont (Font font, int first, int count, int listBase); extern void glXUseXFont (Font font, int first, int count, int listBase);
GLEWAPI GLboolean GLXEW_VERSION_1_0; #define GLXEW_VERSION_1_0 GLXEW_GET_CONTEXT(__GLXEW_VERSION_1_0)
#define glxew_VERSION_1_0 GLXEW_VERSION_1_0
#endif /* GLX_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* glXGetClientString (Display *dpy, int name);
extern const char* glXQueryServerString (Display *dpy, int screen, int name); extern const char* glXQueryServerString (Display *dpy, int screen, int name);
GLEWAPI GLboolean GLXEW_VERSION_1_1; #define GLXEW_VERSION_1_1 GLXEW_GET_CONTEXT(__GLXEW_VERSION_1_1)
#define glxew_VERSION_1_1 GLXEW_VERSION_1_1
#endif /* GLX_VERSION_1_1 */ #endif /* GLX_VERSION_1_1 */