mirror of
https://github.com/nigels-com/glew.git
synced 2024-11-25 23:31:56 +00:00
added check for crippled hardware
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@409 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
parent
8a9cb98efb
commit
782992e803
@ -32,76 +32,89 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
||||
{
|
||||
const GLubyte* s;
|
||||
GLuint major, minor;
|
||||
/* query opengl version */
|
||||
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'))
|
||||
/* check for SiS driver */
|
||||
s = glGetString(GL_RENDERER);
|
||||
if (s && _glewStrSame(s,"SiS",3))
|
||||
{
|
||||
return GLEW_ERROR_GL_VERSION_10_ONLY;
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s[major] >= '2')
|
||||
{
|
||||
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
|
||||
{
|
||||
if (s[minor] >= '5')
|
||||
{
|
||||
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_FALSE;
|
||||
}
|
||||
if (s[minor] == '4')
|
||||
{
|
||||
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_FALSE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
}
|
||||
if (s[minor] == '3')
|
||||
{
|
||||
GLEW_VERSION_1_1 = GL_TRUE;
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_TRUE;
|
||||
GLEW_VERSION_1_4 = 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_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_FALSE;
|
||||
GLEW_VERSION_1_4 = 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;
|
||||
}
|
||||
}
|
||||
/* query opengl version */
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s[major] >= '2')
|
||||
{
|
||||
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
|
||||
{
|
||||
if (s[minor] >= '5')
|
||||
{
|
||||
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_FALSE;
|
||||
}
|
||||
if (s[minor] == '4')
|
||||
{
|
||||
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_FALSE;
|
||||
GLEW_VERSION_2_0 = GL_FALSE;
|
||||
}
|
||||
if (s[minor] == '3')
|
||||
{
|
||||
GLEW_VERSION_1_1 = GL_TRUE;
|
||||
GLEW_VERSION_1_2 = GL_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_TRUE;
|
||||
GLEW_VERSION_1_4 = 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_TRUE;
|
||||
GLEW_VERSION_1_3 = GL_FALSE;
|
||||
GLEW_VERSION_1_4 = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* initialize extensions */
|
||||
|
Loading…
Reference in New Issue
Block a user