mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-30 02:17:07 +00:00
fix for OGL 2.0 problem
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@416 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
ddb1b56915
commit
9fae23bbfd
@ -103,21 +103,25 @@ void* dlGetProcAddress (const GLubyte* name)
|
|||||||
static GLuint _glewStrLen (const GLubyte* s)
|
static GLuint _glewStrLen (const GLubyte* s)
|
||||||
{
|
{
|
||||||
GLuint i=0;
|
GLuint i=0;
|
||||||
while (s+i != NULL && s[i] != '\0') i++;
|
if (s == NULL) return 0;
|
||||||
|
while (s[i] != '\0') i++;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
|
static GLuint _glewStrCLen (const GLubyte* s, GLubyte c)
|
||||||
{
|
{
|
||||||
GLuint i=0;
|
GLuint i=0;
|
||||||
while (s+i != NULL && s[i] != '\0' && s[i] != c) i++;
|
if (s == NULL) return 0;
|
||||||
return i;
|
while (s[i] != '\0' && s[i] != c) i++;
|
||||||
|
return s[i] == c ? i : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
|
static GLboolean _glewStrSame (const GLubyte* a, const GLubyte* b, GLuint n)
|
||||||
{
|
{
|
||||||
GLuint i=0;
|
GLuint i=0;
|
||||||
while (i < n && a+i != NULL && b+i != NULL && a[i] == b[i]) i++;
|
if(a == NULL || b == NULL)
|
||||||
|
return (a == NULL && b == NULL && n == 0) ? GL_TRUE : GL_FALSE;
|
||||||
|
while (i < n && a[i] != '\0' && b[i] != '\0' && a[i] == b[i]) i++;
|
||||||
return i == n ? GL_TRUE : GL_FALSE;
|
return i == n ? GL_TRUE : GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,89 +31,75 @@ static
|
|||||||
GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
||||||
{
|
{
|
||||||
const GLubyte* s;
|
const GLubyte* s;
|
||||||
GLuint major, minor;
|
GLuint dot, major, minor;
|
||||||
/* check for SiS driver */
|
/* query opengl version */
|
||||||
s = glGetString(GL_RENDERER);
|
s = glGetString(GL_VERSION);
|
||||||
if (s && _glewStrSame(s,(const GLubyte*)"SiS",3))
|
dot = _glewStrCLen(s, '.');
|
||||||
|
major = dot-1;
|
||||||
|
minor = dot+1;
|
||||||
|
if (dot == 0 || s[minor] == '\0')
|
||||||
|
return GLEW_ERROR_NO_GL_VERSION;
|
||||||
|
if (s[major] == '1' && s[minor] == '0')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
return GLEW_ERROR_GL_VERSION_10_ONLY;
|
||||||
GLEW_VERSION_1_2 = GL_FALSE;
|
|
||||||
GLEW_VERSION_1_3 = GL_FALSE;
|
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* query opengl version */
|
if (s[major] >= '2')
|
||||||
s = glGetString(GL_VERSION);
|
|
||||||
if (!s) return GLEW_ERROR_NO_GL_VERSION;
|
|
||||||
major = _glewStrCLen(s, '.')-1;
|
|
||||||
minor = _glewStrCLen(s, '.')+1;
|
|
||||||
if (s+major == NULL
|
|
||||||
|| s+minor-1 == NULL || s+minor == NULL
|
|
||||||
|| (s[major] == 1 && s[minor] < '1'))
|
|
||||||
{
|
{
|
||||||
return GLEW_ERROR_GL_VERSION_10_ONLY;
|
GLEW_VERSION_1_1 = GL_TRUE;
|
||||||
|
GLEW_VERSION_1_2 = GL_TRUE;
|
||||||
|
GLEW_VERSION_1_3 = GL_TRUE;
|
||||||
|
GLEW_VERSION_1_4 = GL_TRUE;
|
||||||
|
GLEW_VERSION_1_5 = GL_TRUE;
|
||||||
|
GLEW_VERSION_2_0 = GL_TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (s[major] >= '2')
|
if (s[minor] >= '5')
|
||||||
{
|
{
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
GLEW_VERSION_1_1 = GL_TRUE;
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
GLEW_VERSION_1_2 = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
GLEW_VERSION_1_3 = GL_TRUE;
|
||||||
GLEW_VERSION_1_4 = GL_TRUE;
|
GLEW_VERSION_1_4 = GL_TRUE;
|
||||||
GLEW_VERSION_1_5 = GL_TRUE;
|
GLEW_VERSION_1_5 = GL_TRUE;
|
||||||
GLEW_VERSION_2_0 = GL_TRUE;
|
GLEW_VERSION_2_0 = GL_FALSE;
|
||||||
}
|
}
|
||||||
else
|
if (s[minor] == '4')
|
||||||
{
|
{
|
||||||
if (s[minor] >= '5')
|
GLEW_VERSION_1_1 = GL_TRUE;
|
||||||
{
|
GLEW_VERSION_1_2 = GL_TRUE;
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
GLEW_VERSION_1_3 = GL_TRUE;
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
GLEW_VERSION_1_4 = GL_TRUE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
GLEW_VERSION_1_5 = GL_FALSE;
|
||||||
GLEW_VERSION_1_4 = GL_TRUE;
|
GLEW_VERSION_2_0 = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_TRUE;
|
}
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
if (s[minor] == '3')
|
||||||
}
|
{
|
||||||
if (s[minor] == '4')
|
GLEW_VERSION_1_1 = GL_TRUE;
|
||||||
{
|
GLEW_VERSION_1_2 = GL_TRUE;
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
GLEW_VERSION_1_3 = GL_TRUE;
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
GLEW_VERSION_1_4 = GL_FALSE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
GLEW_VERSION_1_5 = GL_FALSE;
|
||||||
GLEW_VERSION_1_4 = GL_TRUE;
|
GLEW_VERSION_2_0 = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
}
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
if (s[minor] == '2')
|
||||||
}
|
{
|
||||||
if (s[minor] == '3')
|
GLEW_VERSION_1_1 = GL_TRUE;
|
||||||
{
|
GLEW_VERSION_1_2 = GL_TRUE;
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
GLEW_VERSION_1_3 = GL_FALSE;
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
GLEW_VERSION_1_4 = GL_FALSE;
|
||||||
GLEW_VERSION_1_3 = GL_TRUE;
|
GLEW_VERSION_1_5 = GL_FALSE;
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
GLEW_VERSION_2_0 = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
}
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
if (s[minor] < '2')
|
||||||
}
|
{
|
||||||
if (s[minor] == '2')
|
GLEW_VERSION_1_1 = GL_TRUE;
|
||||||
{
|
GLEW_VERSION_1_2 = GL_FALSE;
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
GLEW_VERSION_1_3 = GL_FALSE;
|
||||||
GLEW_VERSION_1_2 = GL_TRUE;
|
GLEW_VERSION_1_4 = GL_FALSE;
|
||||||
GLEW_VERSION_1_3 = GL_FALSE;
|
GLEW_VERSION_1_5 = GL_FALSE;
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
GLEW_VERSION_2_0 = GL_FALSE;
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
|
||||||
}
|
|
||||||
if (s[minor] < '2')
|
|
||||||
{
|
|
||||||
GLEW_VERSION_1_1 = GL_TRUE;
|
|
||||||
GLEW_VERSION_1_2 = GL_FALSE;
|
|
||||||
GLEW_VERSION_1_3 = GL_FALSE;
|
|
||||||
GLEW_VERSION_1_4 = GL_FALSE;
|
|
||||||
GLEW_VERSION_1_5 = GL_FALSE;
|
|
||||||
GLEW_VERSION_2_0 = GL_FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user