Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

potential glewGetExtension() fix

By: a guest on Oct 5th, 2010  |  syntax: C  |  size: 0.91 KB  |  views: 111  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // 05/10/2010 Modified by BenXYZ from the GLEW project, see copyright: http://glew.sourceforge.net/credits.html
  2.  
  3. GLboolean glewGetExtension (const char* name)
  4. {
  5.   GLubyte* p;
  6.   GLubyte* end;
  7.   GLuint len = _glewStrLen((const GLubyte*)name);
  8.   p = (GLubyte*)glGetString(GL_EXTENSIONS);
  9.  
  10.   //if glGetString() failed, attempt glGetStringi()
  11.   if (0 == p)
  12.   {
  13.     GLint numextns; glGetIntegerv(GL_NUM_EXTENSIONS, &numextns);
  14.     GLuint iii;
  15.     for (iii = 0; iii < numextns; iii++)
  16.     {
  17.       p = glGetStringi(GL_EXTENSIONS, iii);
  18.       if (_glewStrSame((const GLubyte*)name, p, _glewStrLen(p))) return GL_TRUE;
  19.     }
  20.     return GL_FALSE;
  21.   }
  22.  
  23.   //...or if glGetString() worked, carry on as usual
  24.   end = p + _glewStrLen(p);
  25.   while (p < end)
  26.   {
  27.     GLuint n = _glewStrCLen(p, ' ');
  28.     if (len == n && _glewStrSame((const GLubyte*)name, p, n)) return GL_TRUE;
  29.     p += n+1;
  30.   }
  31.   return GL_FALSE;
  32. }