kusano 7d535a
/* ------------------------------------------------------------------------- */
kusano 7d535a
kusano 7d535a
GLboolean GLEWAPIENTRY glewGetExtension (const char* name)
kusano 7d535a
{    
kusano 7d535a
  const GLubyte* start;
kusano 7d535a
  const GLubyte* end;
kusano 7d535a
  start = (const GLubyte*)glGetString(GL_EXTENSIONS);
kusano 7d535a
  if (start == 0)
kusano 7d535a
    return GL_FALSE;
kusano 7d535a
  end = start + _glewStrLen(start);
kusano 7d535a
  return _glewSearchExtension(name, start, end);
kusano 7d535a
}
kusano 7d535a
kusano 7d535a
/* ------------------------------------------------------------------------- */
kusano 7d535a
kusano 7d535a
#ifndef GLEW_MX
kusano 7d535a
static
kusano 7d535a
#endif
kusano 7d535a
GLenum GLEWAPIENTRY glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST)
kusano 7d535a
{
kusano 7d535a
  const GLubyte* s;
kusano 7d535a
  GLuint dot;
kusano 7d535a
  GLint major, minor;
kusano 7d535a
  const GLubyte* extStart;
kusano 7d535a
  const GLubyte* extEnd;
kusano 7d535a
  /* query opengl version */
kusano 7d535a
  s = glGetString(GL_VERSION);
kusano 7d535a
  dot = _glewStrCLen(s, '.');
kusano 7d535a
  if (dot == 0)
kusano 7d535a
    return GLEW_ERROR_NO_GL_VERSION;
kusano 7d535a
  
kusano 7d535a
  major = s[dot-1]-'0';
kusano 7d535a
  minor = s[dot+1]-'0';
kusano 7d535a
kusano 7d535a
  if (minor < 0 || minor > 9)
kusano 7d535a
    minor = 0;
kusano 7d535a
  if (major<0 || major>9)
kusano 7d535a
    return GLEW_ERROR_NO_GL_VERSION;
kusano 7d535a
  
kusano 7d535a
kusano 7d535a
  if (major == 1 && minor == 0)
kusano 7d535a
  {
kusano 7d535a
    return GLEW_ERROR_GL_VERSION_10_ONLY;
kusano 7d535a
  }
kusano 7d535a
  else
kusano 7d535a
  {
kusano 7d535a
    CONST_CAST(GLEW_VERSION_4_3)   = ( major > 4 )                 || ( major == 4 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_4_2)   = GLEW_VERSION_4_3   == GL_TRUE || ( major == 4 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_4_1)   = GLEW_VERSION_4_2   == GL_TRUE || ( major == 4 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_4_0)   = GLEW_VERSION_4_1   == GL_TRUE || ( major == 4               ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_3_3)   = GLEW_VERSION_4_0   == GL_TRUE || ( major == 3 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_3_2)   = GLEW_VERSION_3_3   == GL_TRUE || ( major == 3 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_3_1)   = GLEW_VERSION_3_2   == GL_TRUE || ( major == 3 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_3_0)   = GLEW_VERSION_3_1   == GL_TRUE || ( major == 3               ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_2_1)   = GLEW_VERSION_3_0   == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE;    
kusano 7d535a
    CONST_CAST(GLEW_VERSION_2_0)   = GLEW_VERSION_2_1   == GL_TRUE || ( major == 2               ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_1_5)   = GLEW_VERSION_2_0   == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_1_4)   = GLEW_VERSION_1_5   == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_1_3)   = GLEW_VERSION_1_4   == GL_TRUE || ( major == 1 && minor >= 3 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_1_2_1) = GLEW_VERSION_1_3   == GL_TRUE                                 ? GL_TRUE : GL_FALSE; 
kusano 7d535a
    CONST_CAST(GLEW_VERSION_1_2)   = GLEW_VERSION_1_2_1 == GL_TRUE || ( major == 1 && minor >= 2 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
    CONST_CAST(GLEW_VERSION_1_1)   = GLEW_VERSION_1_2   == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE;
kusano 7d535a
  }
kusano 7d535a
kusano 7d535a
  /* query opengl extensions string */
kusano 7d535a
  extStart = glGetString(GL_EXTENSIONS);
kusano 7d535a
  if (extStart == 0)
kusano 7d535a
    extStart = (const GLubyte*)"";
kusano 7d535a
  extEnd = extStart + _glewStrLen(extStart);
kusano 7d535a
kusano 7d535a
  /* initialize extensions */