mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-25 23:31:56 +00:00
*** empty log message ***
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@124 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
0bdd4b122f
commit
cb58541cd0
@ -5,23 +5,23 @@
|
||||
* These functions implement the functionality required in this file.
|
||||
*/
|
||||
|
||||
static int _glewStrLen (const char *s)
|
||||
static GLuint _glewStrLen (const GLubyte *s)
|
||||
{
|
||||
int i=0;
|
||||
GLuint i=0;
|
||||
while (s+i != NULL && s[i] != '\0') i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
static int _glewStrCLen (const char *s, char c)
|
||||
static GLuint _glewStrCLen (const GLubyte *s, GLubyte c)
|
||||
{
|
||||
int i=0;
|
||||
GLuint i=0;
|
||||
while (s+i != NULL && s[i] != '\0' && s[i] != c) i++;
|
||||
return i;
|
||||
}
|
||||
|
||||
static int _glewStrSame (const char *a, const char *b, int n)
|
||||
static GLboolean _glewStrSame (const GLubyte *a, const GLubyte *b, GLuint n)
|
||||
{
|
||||
int i=0;
|
||||
GLuint i=0;
|
||||
while (i < n && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
||||
return i == n;
|
||||
}
|
||||
@ -34,14 +34,14 @@ static int _glewStrSame (const char *a, const char *b, int n)
|
||||
*/
|
||||
GLboolean glewGetExtension (const GLubyte *name)
|
||||
{
|
||||
char *p, *end;
|
||||
int len = _glewStrLen(name);
|
||||
p = (char*)glGetString(GL_EXTENSIONS);
|
||||
GLubyte *p, *end;
|
||||
GLuint len = _glewStrLen(name);
|
||||
p = glGetString(GL_EXTENSIONS);
|
||||
if (0 == p) return GL_FALSE;
|
||||
end = p + _glewStrLen(p);
|
||||
while (p < end)
|
||||
{
|
||||
int n = _glewStrCLen(p, ' ');
|
||||
GLuint n = _glewStrCLen(p, ' ');
|
||||
if (len == n && _glewStrSame(name, p, n)) return GL_TRUE;
|
||||
p += n+1;
|
||||
}
|
||||
@ -52,10 +52,10 @@ GLboolean glewGetExtension (const GLubyte *name)
|
||||
|
||||
static GLuint _glewInit ()
|
||||
{
|
||||
char* s;
|
||||
int i;
|
||||
GLubyte* s;
|
||||
GLuint i;
|
||||
/* query opengl version */
|
||||
s = (char*)glGetString(GL_VERSION);
|
||||
s = glGetString(GL_VERSION);
|
||||
if (!s) return GLEW_ERROR_NO_GL_VERSION;
|
||||
i=_glewStrCLen(s, '.')+1;
|
||||
if (s+i == NULL || s[i] < '1')
|
||||
|
@ -3,30 +3,17 @@
|
||||
|
||||
#else /* _UNIX */
|
||||
|
||||
GLboolean glxewGetExtension (const char *name)
|
||||
GLboolean glxewGetExtension (const GLubyte *name)
|
||||
{
|
||||
char *p, *end;
|
||||
int len = _glewStrLen(name);
|
||||
#if 1
|
||||
GLubyte *p, *end;
|
||||
GLuint len = _glewStrLen(name);
|
||||
if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE;
|
||||
p = (char*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay()));
|
||||
#else
|
||||
/* Temporary fix to avoid using glXGetCurrentDisplay,
|
||||
which crashes GLEW on some configurations. */
|
||||
{
|
||||
Display *dpy;
|
||||
if (glXQueryExtensionsString == NULL) return GL_FALSE;
|
||||
dpy = XOpenDisplay(NULL);
|
||||
if (dpy == NULL) return GL_FALSE;
|
||||
p = (char*)glXQueryExtensionsString(dpy, DefaultScreen(dpy));
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
#endif
|
||||
p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay()));
|
||||
if (0 == p) return GL_FALSE;
|
||||
end = p + _glewStrLen(p);
|
||||
while (p < end)
|
||||
{
|
||||
int n = _glewStrCLen(p, ' ');
|
||||
GLuint n = _glewStrCLen(p, ' ');
|
||||
if (len == n && _glewStrSame(name, p, n)) return GL_TRUE;
|
||||
p += n+1;
|
||||
}
|
||||
@ -39,18 +26,7 @@ static GLuint _glxewInit ()
|
||||
/* initialize core GLX 1.2 */
|
||||
if (_glewInit_GLX_VERSION_1_2()) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
/* query GLX version */
|
||||
#if 1
|
||||
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
||||
#else
|
||||
/* Temporary fix to avoid using glXGetCurrentDisplay,
|
||||
which crashes GLEW on some configurations. */
|
||||
{
|
||||
Display* dpy = XOpenDisplay(NULL);
|
||||
if (dpy == NULL) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
||||
glXQueryVersion(dpy, &major, &minor);
|
||||
XCloseDisplay(dpy);
|
||||
}
|
||||
#endif
|
||||
switch (minor)
|
||||
{
|
||||
case 4:
|
||||
|
@ -5,22 +5,22 @@
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
GLboolean wglewGetExtension (const char *name)
|
||||
GLboolean wglewGetExtension (const GLubyte *name)
|
||||
{
|
||||
char *p, *end;
|
||||
int len = _glewStrLen(name);
|
||||
GLubyte *p, *end;
|
||||
GLuint len = _glewStrLen(name);
|
||||
if (wglGetExtensionsStringARB == NULL)
|
||||
if (wglGetExtensionsStringEXT == NULL)
|
||||
return GL_FALSE;
|
||||
else
|
||||
p = (char*)wglGetExtensionsStringEXT();
|
||||
p = (GLubyte*)wglGetExtensionsStringEXT();
|
||||
else
|
||||
p = (char*)wglGetExtensionsStringARB(wglGetCurrentDC());
|
||||
p = (GLubyte*)wglGetExtensionsStringARB(wglGetCurrentDC());
|
||||
if (0 == p) return GL_FALSE;
|
||||
end = p + _glewStrLen(p);
|
||||
while (p < end)
|
||||
{
|
||||
int n = _glewStrCLen(p, ' ');
|
||||
GLuint n = _glewStrCLen(p, ' ');
|
||||
if (len == n && _glewStrSame(name, p, n)) return GL_TRUE;
|
||||
p += n+1;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
static FILE* f;
|
||||
|
||||
static void glewPrintExt (const char* name, int defined)
|
||||
static void glewPrintExt (const GLubyte* name, GLboolean defined)
|
||||
{
|
||||
unsigned int i;
|
||||
fprintf(f, "\n%s:", name);
|
||||
@ -49,7 +49,7 @@ static void glewPrintExt (const char* name, int defined)
|
||||
fflush(f);
|
||||
}
|
||||
|
||||
static void glewInfoFunc (const char* name, int undefined)
|
||||
static void glewInfoFunc (const GLubyte* name, GLboolean undefined)
|
||||
{
|
||||
unsigned int i;
|
||||
fprintf(f, " %s:", name);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ------------------------------------------------------------------------ */
|
||||
|
||||
extern GLboolean glxewGetExtension (const char* name);
|
||||
extern GLboolean glxewGetExtension (const GLubyte* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
GLEWAPI GLboolean wglewGetExtension (const char* name);
|
||||
GLEWAPI GLboolean wglewGetExtension (const GLubyte* name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user