1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/pvr2/glutil.c Fri Mar 28 12:32:25 2008 +0000
1.7 + * GL-based support functions
1.9 + * Copyright (c) 2005 Nathan Keynes.
1.11 + * This program is free software; you can redistribute it and/or modify
1.12 + * it under the terms of the GNU General Public License as published by
1.13 + * the Free Software Foundation; either version 2 of the License, or
1.14 + * (at your option) any later version.
1.16 + * This program is distributed in the hope that it will be useful,
1.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.19 + * GNU General Public License for more details.
1.21 +#include <string.h>
1.22 +#include "pvr2/glutil.h"
1.25 + * Test if a specific extension is supported. From opengl.org
1.26 + * @param extension extension name to check for
1.27 + * @return TRUE if supported, otherwise FALSE.
1.29 +gboolean isGLExtensionSupported( const char *extension )
1.31 + const GLubyte *extensions = NULL;
1.32 + const GLubyte *start;
1.33 + GLubyte *where, *terminator;
1.35 + /* Extension names should not have spaces. */
1.36 + where = (GLubyte *) strchr(extension, ' ');
1.37 + if (where || *extension == '\0')
1.39 + extensions = glGetString(GL_EXTENSIONS);
1.40 + if( extensions == NULL ) {
1.41 + /* No GL available, so we're pretty sure the extension isn't
1.42 + * available either. */
1.45 + /* It takes a bit of care to be fool-proof about parsing the
1.46 + OpenGL extensions string. Don't be fooled by sub-strings,
1.48 + start = extensions;
1.50 + where = (GLubyte *) strstr((const char *) start, extension);
1.53 + terminator = where + strlen(extension);
1.54 + if (where == start || *(where - 1) == ' ')
1.55 + if (*terminator == ' ' || *terminator == '\0')
1.57 + start = terminator;