added GL_VERSION_2_0

git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@299 783a27ee-832a-0410-bc00-9f386506c6dd
This commit is contained in:
ikits 2004-09-28 20:25:51 +00:00
parent ba99386119
commit 63374ccd9c
3 changed files with 63 additions and 35 deletions

1
auto/core/GL_VERSION_2_0 Normal file
View File

@ -0,0 +1 @@
GL_VERSION_2_0

View File

@ -57,56 +57,77 @@ static
GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
{ {
const GLubyte* s; const GLubyte* s;
GLuint i; GLuint major, minor;
/* query opengl version */ /* query opengl version */
s = glGetString(GL_VERSION); s = glGetString(GL_VERSION);
if (!s) return GLEW_ERROR_NO_GL_VERSION; if (!s) return GLEW_ERROR_NO_GL_VERSION;
i = _glewStrCLen(s, '.')+1; major = _glewStrCLen(s, '.')-1;
if (s+i-1 == NULL || s+i == NULL || s[i] < '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; return GLEW_ERROR_GL_VERSION_10_ONLY;
} }
else else
{ {
if (s[i] >= '5') if (s[major] >= '2')
{ {
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;
} }
if (s[i] == '4') 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_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_FALSE; GLEW_VERSION_1_5 = GL_FALSE;
GLEW_VERSION_2_0 = GL_FALSE;
} }
if (s[i] == '3') if (s[minor] == '3')
{ {
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_FALSE; GLEW_VERSION_1_4 = GL_FALSE;
GLEW_VERSION_1_5 = GL_FALSE; GLEW_VERSION_1_5 = GL_FALSE;
GLEW_VERSION_2_0 = GL_FALSE;
} }
if (s[i] == '2') if (s[minor] == '2')
{ {
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_FALSE; GLEW_VERSION_1_3 = GL_FALSE;
GLEW_VERSION_1_4 = GL_FALSE; GLEW_VERSION_1_4 = GL_FALSE;
GLEW_VERSION_1_5 = GL_FALSE; GLEW_VERSION_1_5 = GL_FALSE;
GLEW_VERSION_2_0 = GL_FALSE;
} }
if (s[i] < '2') if (s[minor] < '2')
{ {
GLEW_VERSION_1_1 = GL_TRUE; GLEW_VERSION_1_1 = GL_TRUE;
GLEW_VERSION_1_2 = GL_FALSE; GLEW_VERSION_1_2 = GL_FALSE;
GLEW_VERSION_1_3 = GL_FALSE; GLEW_VERSION_1_3 = GL_FALSE;
GLEW_VERSION_1_4 = GL_FALSE; GLEW_VERSION_1_4 = GL_FALSE;
GLEW_VERSION_1_5 = GL_FALSE; GLEW_VERSION_1_5 = GL_FALSE;
GLEW_VERSION_2_0 = GL_FALSE;
}
} }
} }
/* initialize extensions */ /* initialize extensions */

View File

@ -1096,6 +1096,13 @@ GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh
#endif /* GL_VERSION_1_1 */ #endif /* GL_VERSION_1_1 */
#ifndef GL_VERSION_2_0
#define GL_VERSION_2_0 1
#define GLEW_VERSION_2_0 GLEW_GET_VAR(__GLEW_VERSION_2_0)
#endif /* GL_VERSION_2_0 */
/* ---------------------------------- GLU ---------------------------------- */ /* ---------------------------------- GLU ---------------------------------- */
/* this is where we can safely include GLU */ /* this is where we can safely include GLU */
@ -1105,4 +1112,3 @@ GLAPI void GLAPIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei heigh
#include <GL/glu.h> #include <GL/glu.h>
#endif #endif