2003-07-06 15:01:13 +00:00
|
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
|
2012-05-04 19:54:08 +00:00
|
|
|
const GLubyte * GLEWAPIENTRY glewGetErrorString (GLenum error)
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
2003-09-12 03:50:22 +00:00
|
|
|
static const GLubyte* _glewErrorString[] =
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
2003-10-27 05:28:55 +00:00
|
|
|
(const GLubyte*)"No error",
|
|
|
|
(const GLubyte*)"Missing GL version",
|
|
|
|
(const GLubyte*)"GL 1.1 and up are not supported",
|
|
|
|
(const GLubyte*)"GLX 1.2 and up are not supported",
|
|
|
|
(const GLubyte*)"Unknown error"
|
2003-07-06 15:01:13 +00:00
|
|
|
};
|
2014-07-14 07:02:27 +00:00
|
|
|
const size_t max_error = sizeof(_glewErrorString)/sizeof(*_glewErrorString) - 1;
|
|
|
|
return _glewErrorString[(size_t)error > max_error ? max_error : (size_t)error];
|
2003-07-06 15:01:13 +00:00
|
|
|
}
|
|
|
|
|
2012-05-04 19:54:08 +00:00
|
|
|
const GLubyte * GLEWAPIENTRY glewGetString (GLenum name)
|
2003-09-12 03:50:22 +00:00
|
|
|
{
|
|
|
|
static const GLubyte* _glewString[] =
|
|
|
|
{
|
2003-10-27 05:28:55 +00:00
|
|
|
(const GLubyte*)NULL,
|
2007-12-28 00:24:07 +00:00
|
|
|
(const GLubyte*)"GLEW_VERSION_STRING",
|
|
|
|
(const GLubyte*)"GLEW_VERSION_MAJOR_STRING",
|
|
|
|
(const GLubyte*)"GLEW_VERSION_MINOR_STRING",
|
|
|
|
(const GLubyte*)"GLEW_VERSION_MICRO_STRING"
|
2003-09-12 03:50:22 +00:00
|
|
|
};
|
2014-07-14 07:02:27 +00:00
|
|
|
const size_t max_string = sizeof(_glewString)/sizeof(*_glewString) - 1;
|
|
|
|
return _glewString[(size_t)name > max_string ? 0 : (size_t)name];
|
2003-09-12 03:50:22 +00:00
|
|
|
}
|
|
|
|
|
2003-07-06 15:01:13 +00:00
|
|
|
/* ------------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
GLboolean glewExperimental = GL_FALSE;
|
|
|
|
|
2012-05-04 19:54:08 +00:00
|
|
|
GLenum GLEWAPIENTRY glewInit (void)
|
2003-07-06 15:01:13 +00:00
|
|
|
{
|
2003-09-12 03:50:22 +00:00
|
|
|
GLenum r;
|
2016-01-26 12:53:39 +00:00
|
|
|
#if defined(GLEW_EGL)
|
|
|
|
PFNEGLGETCURRENTDISPLAYPROC getCurrentDisplay = NULL;
|
|
|
|
#endif
|
2012-05-04 16:03:37 +00:00
|
|
|
r = glewContextInit();
|
|
|
|
if ( r != 0 ) return r;
|
2016-01-20 11:55:08 +00:00
|
|
|
#if defined(GLEW_EGL)
|
2016-01-26 12:53:39 +00:00
|
|
|
getCurrentDisplay = (PFNEGLGETCURRENTDISPLAYPROC) glewGetProcAddress("eglGetCurrentDisplay");
|
|
|
|
return eglewInit(getCurrentDisplay());
|
2016-01-20 11:55:08 +00:00
|
|
|
#elif defined(GLEW_OSMESA) || defined(__ANDROID__) || defined(__native_client__) || defined(__HAIKU__)
|
2014-06-24 15:03:28 +00:00
|
|
|
return r;
|
2015-10-08 12:03:16 +00:00
|
|
|
#elif defined(_WIN32)
|
2015-08-07 07:10:09 +00:00
|
|
|
return wglewInit();
|
2015-10-08 12:03:16 +00:00
|
|
|
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX) /* _UNIX */
|
2015-08-07 07:10:09 +00:00
|
|
|
return glxewInit();
|
2003-10-27 01:06:34 +00:00
|
|
|
#else
|
|
|
|
return r;
|
2003-07-06 15:01:13 +00:00
|
|
|
#endif /* _WIN32 */
|
|
|
|
}
|