4 * GL-based support functions
6 * Copyright (c) 2005 Nathan Keynes.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
19 #include "pvr2/glutil.h"
22 * Test if a specific extension is supported. From opengl.org
23 * @param extension extension name to check for
24 * @return TRUE if supported, otherwise FALSE.
26 gboolean isGLExtensionSupported( const char *extension )
28 const GLubyte *extensions = NULL;
30 GLubyte *where, *terminator;
32 /* Extension names should not have spaces. */
33 where = (GLubyte *) strchr(extension, ' ');
34 if (where || *extension == '\0')
36 extensions = glGetString(GL_EXTENSIONS);
37 if( extensions == NULL ) {
38 /* No GL available, so we're pretty sure the extension isn't
39 * available either. */
42 /* It takes a bit of care to be fool-proof about parsing the
43 OpenGL extensions string. Don't be fooled by sub-strings,
47 where = (GLubyte *) strstr((const char *) start, extension);
50 terminator = where + strlen(extension);
51 if (where == start || *(where - 1) == ' ')
52 if (*terminator == ' ' || *terminator == '\0')
.