mirror of
https://github.com/nigels-com/glew.git
synced 2025-01-31 08:50:26 +00:00
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:
parent
04f2f79b2e
commit
ac1bbc2f0e
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user