~ubuntu-branches/ubuntu/trusty/glew/trusty

« back to all changes in this revision

Viewing changes to auto/src/glew_init_glx.c

  • Committer: Bazaar Package Importer
  • Author(s): Joost Yervante Damad
  • Date: 2009-05-11 17:48:06 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090511174806-hpbwcimkr4ir0mfl
Tags: 1.5.1-4
make sure mx library really is MX (closes: #528232)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* ------------------------------------------------------------------------ */
2
 
 
3
 
GLboolean glxewGetExtension (const char* name)
4
 
{    
5
 
  GLubyte* p;
6
 
  GLubyte* end;
7
 
  GLuint len = _glewStrLen((const GLubyte*)name);
8
 
/*   if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; */
9
 
/*   p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); */
10
 
  if (glXGetClientString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE;
11
 
  p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
12
 
  if (0 == p) return GL_FALSE;
13
 
  end = p + _glewStrLen(p);
14
 
  while (p < end)
15
 
  {
16
 
    GLuint n = _glewStrCLen(p, ' ');
17
 
    if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE;
18
 
    p += n+1;
19
 
  }
20
 
  return GL_FALSE;
21
 
}
22
 
 
23
 
GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
24
 
{
25
 
  int major, minor;
26
 
  /* initialize core GLX 1.2 */
27
 
  if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
28
 
  /* initialize flags */
29
 
  CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE;
30
 
  CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE;
31
 
  CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE;
32
 
  CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE;
33
 
  CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE;
34
 
  /* query GLX version */
35
 
  glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
36
 
  if (major == 1 && minor <= 3)
37
 
  {
38
 
    switch (minor)
39
 
    {
40
 
      case 3:
41
 
      CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
42
 
      break;
43
 
      case 2:
44
 
      CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
45
 
      CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE;
46
 
      break;
47
 
      default:
48
 
      return GLEW_ERROR_GLX_VERSION_11_ONLY;
49
 
      break;
50
 
    }
51
 
  }
52
 
  /* initialize extensions */
 
1
/* ------------------------------------------------------------------------ */
 
2
 
 
3
GLboolean glxewGetExtension (const char* name)
 
4
{    
 
5
  GLubyte* p;
 
6
  GLubyte* end;
 
7
  GLuint len = _glewStrLen((const GLubyte*)name);
 
8
/*   if (glXQueryExtensionsString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE; */
 
9
/*   p = (GLubyte*)glXQueryExtensionsString(glXGetCurrentDisplay(), DefaultScreen(glXGetCurrentDisplay())); */
 
10
  if (glXGetClientString == NULL || glXGetCurrentDisplay == NULL) return GL_FALSE;
 
11
  p = (GLubyte*)glXGetClientString(glXGetCurrentDisplay(), GLX_EXTENSIONS);
 
12
  if (0 == p) return GL_FALSE;
 
13
  end = p + _glewStrLen(p);
 
14
  while (p < end)
 
15
  {
 
16
    GLuint n = _glewStrCLen(p, ' ');
 
17
    if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE;
 
18
    p += n+1;
 
19
  }
 
20
  return GL_FALSE;
 
21
}
 
22
 
 
23
GLenum glxewContextInit (GLXEW_CONTEXT_ARG_DEF_LIST)
 
24
{
 
25
  int major, minor;
 
26
  /* initialize core GLX 1.2 */
 
27
  if (_glewInit_GLX_VERSION_1_2(GLEW_CONTEXT_ARG_VAR_INIT)) return GLEW_ERROR_GLX_VERSION_11_ONLY;
 
28
  /* initialize flags */
 
29
  CONST_CAST(GLXEW_VERSION_1_0) = GL_TRUE;
 
30
  CONST_CAST(GLXEW_VERSION_1_1) = GL_TRUE;
 
31
  CONST_CAST(GLXEW_VERSION_1_2) = GL_TRUE;
 
32
  CONST_CAST(GLXEW_VERSION_1_3) = GL_TRUE;
 
33
  CONST_CAST(GLXEW_VERSION_1_4) = GL_TRUE;
 
34
  /* query GLX version */
 
35
  glXQueryVersion(glXGetCurrentDisplay(), &major, &minor);
 
36
  if (major == 1 && minor <= 3)
 
37
  {
 
38
    switch (minor)
 
39
    {
 
40
      case 3:
 
41
      CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
 
42
      break;
 
43
      case 2:
 
44
      CONST_CAST(GLXEW_VERSION_1_4) = GL_FALSE;
 
45
      CONST_CAST(GLXEW_VERSION_1_3) = GL_FALSE;
 
46
      break;
 
47
      default:
 
48
      return GLEW_ERROR_GLX_VERSION_11_ONLY;
 
49
      break;
 
50
    }
 
51
  }
 
52
  /* initialize extensions */