glew/auto/src/glew_init_glx.c

54 lines
1.6 KiB
C
Raw Normal View History

/* ------------------------------------------------------------------------ */
GLboolean glxewGetExtension (const char* name)
{
const GLubyte* start;
const GLubyte* end;
if (glXGetCurrentDisplay == NULL) return GL_FALSE;
start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
if (0 == start) return GL_FALSE;
end = start + _glewStrLen(start);
return _glewSearchExtension(name, start, end);
}
GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
{
int major, minor;
const GLubyte* start;
const GLubyte* end;
/* 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;
}
}
/* query GLX extension string */
start = 0;
if (glXGetCurrentDisplay != NULL)
start = (const GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
if (start == 0)
start = (const GLubyte *)"";
end = start + _glewStrLen(start);
/* initialize extensions */