2003-07-06 15:01:13 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2012-05-07 14:05:12 +00:00
|
|
|
GLboolean GLEWAPIENTRY glewGetExtension (const char* name)
|
2013-07-14 18:02:16 +00:00
|
|
|
{
|
2011-03-30 16:38:25 +00:00
|
|
|
const GLubyte* start;
|
|
|
|
const GLubyte* end;
|
2013-07-14 18:02:16 +00:00
|
|
|
GLuint dot;
|
|
|
|
GLint numExt, i, major;
|
|
|
|
/* query opengl version to decide how to enumerate extensions */
|
|
|
|
start = glGetString(GL_VERSION);
|
|
|
|
dot = _glewStrCLen(start, '.');
|
|
|
|
if (dot == 0)
|
|
|
|
return GL_FALSE;
|
|
|
|
major = start[dot-1]-'0';
|
|
|
|
|
|
|
|
if (major >= 3)
|
|
|
|
{
|
|
|
|
glGetIntegerv(GL_NUM_EXTENSIONS, &numExt);
|
|
|
|
for(i = 0; i < numExt; ++i)
|
|
|
|
{
|
|
|
|
start = glGetStringi(GL_EXTENSIONS, i);
|
|
|
|
end = start + _glewStrLen(start);
|
|
|
|
if(_glewSearchExtension(name, start, end) == GL_TRUE)
|
|
|
|
return GL_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
start = (const GLubyte*)glGetString(GL_EXTENSIONS);
|
|
|
|
if (start == 0)
|
|
|
|
return GL_FALSE;
|
|
|
|
end = start + _glewStrLen(start);
|
|
|
|
return _glewSearchExtension(name, start, end);
|
|
|
|
}
|
|
|
|
return GL_FALSE;
|
2003-07-06 15:01:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2004-02-19 04:37:07 +00:00
|
|
|
#ifndef GLEW_MX
|
|
|
|
static
|
|
|
|
#endif
|
2012-05-07 14:05:12 +00:00
|
|
|
GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
2003-09-15 17:01:44 +00:00
|
|
|
const GLubyte* s;
|
2009-03-31 21:16:33 +00:00
|
|
|
GLuint dot;
|
|
|
|
GLint major, minor;
|
2013-07-14 18:02:16 +00:00
|
|
|
const GLubyte* extArray[1000];
|
|
|
|
const GLubyte** extArrayStart;
|
|
|
|
const GLubyte** extArrayEnd;
|
2011-03-31 12:49:53 +00:00
|
|
|
const GLubyte* extStart;
|
|
|
|
const GLubyte* extEnd;
|
2005-04-05 03:49:48 +00:00
|
|
|
/* query opengl version */
|
|
|
|
s = glGetString(GL_VERSION);
|
|
|
|
dot = _glewStrCLen(s, '.');
|
2009-03-31 21:16:33 +00:00
|
|
|
if (dot == 0)
|
2005-04-05 03:49:48 +00:00
|
|
|
return GLEW_ERROR_NO_GL_VERSION;
|
2009-03-31 21:16:33 +00:00
|
|
|
|
|
|
|
major = s[dot-1]-'0';
|
|
|
|
minor = s[dot+1]-'0';
|
|
|
|
|
|
|
|
if (minor < 0 || minor > 9)
|
|
|
|
minor = 0;
|
|
|
|
if (major<0 || major>9)
|
|
|
|
return GLEW_ERROR_NO_GL_VERSION;
|
|
|
|
|
|
|
|
|
|
|
|
if (major == 1 && minor == 0)
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
2009-03-31 21:16:33 +00:00
|
|
|
return GLEW_ERROR_GL_VERSION_10_ONLY;
|
2003-07-06 15:01:13 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-06 14:17:50 +00:00
|
|
|
CONST_CAST(GLEW_VERSION_4_3) = ( major > 4 ) || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_4_2) = GLEW_VERSION_4_3 == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
2011-08-02 14:21:40 +00:00
|
|
|
CONST_CAST(GLEW_VERSION_4_1) = GLEW_VERSION_4_2 == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
2010-10-30 01:13:55 +00:00
|
|
|
CONST_CAST(GLEW_VERSION_4_0) = GLEW_VERSION_4_1 == GL_TRUE || ( major == 4 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_3_3) = GLEW_VERSION_4_0 == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_3_2) = GLEW_VERSION_3_3 == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_3_1) = GLEW_VERSION_3_2 == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_3_0) = GLEW_VERSION_3_1 == GL_TRUE || ( major == 3 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_2_1) = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_2_0) = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_1_5) = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_1_4) = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_1_3) = GLEW_VERSION_1_4 == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_1_2_1) = GLEW_VERSION_1_3 == GL_TRUE ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_1_2) = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
|
|
|
|
CONST_CAST(GLEW_VERSION_1_1) = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
|
2003-07-06 15:01:13 +00:00
|
|
|
}
|
2011-03-30 16:38:25 +00:00
|
|
|
|
2013-07-14 18:02:16 +00:00
|
|
|
/* initialize core */
|