mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-12-04 12:27:07 +00:00
a8ddad81de
git-svn-id: https://glew.svn.sourceforge.net/svnroot/glew/trunk/glew@548 783a27ee-832a-0410-bc00-9f386506c6dd
53 lines
1.5 KiB
C
53 lines
1.5 KiB
C
/* ------------------------------------------------------------------------ */
|
|
|
|
GLboolean glxewGetExtension (const char* name)
|
|
{
|
|
GLubyte* p;
|
|
GLubyte* end;
|
|
GLuint len;
|
|
|
|
if (glXGetCurrentDisplay == NULL) return GL_FALSE;
|
|
len = _glewStrLen((const GLubyte*)name);
|
|
p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
|
|
if (0 == p) return GL_FALSE;
|
|
end = p + _glewStrLen(p);
|
|
while (p < end)
|
|
{
|
|
GLuint n = _glewStrCLen(p, ' ');
|
|
if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE;
|
|
p += n+1;
|
|
}
|
|
return GL_FALSE;
|
|
}
|
|
|
|
GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
|
|
{
|
|
int major, minor;
|
|
/* initialize core GLX 1.2 */
|
|
if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
|
/* initialize flags */
|
|
CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE;
|
|
CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE;
|
|
CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE;
|
|
CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE;
|
|
CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE;
|
|
/* query GLX version */
|
|
glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
|
|
if (major == 1 && minor <= 3)
|
|
{
|
|
switch (minor)
|
|
{
|
|
case 3:
|
|
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
|
break;
|
|
case 2:
|
|
CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
|
|
CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE;
|
|
break;
|
|
default:
|
|
return GLEW_ERROR_GLX_VERSION_11_ONLY;
|
|
break;
|
|
}
|
|
}
|
|
/* initialize extensions */
|