2 * $Id: video_gl.c,v 1.2 2007-01-15 12:57:12 nkeynes Exp $
4 * Common GL code that doesn't depend on a specific implementation
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.
20 #include "drivers/video_gl.h"
23 char *required_extensions[] = { "GL_EXT_framebuffer_object", NULL };
26 * Test if a specific extension is supported. From opengl.org
27 * @param extension extension name to check for
28 * @return TRUE if supported, otherwise FALSE.
30 gboolean isGLExtensionSupported( const char *extension )
32 const GLubyte *extensions = NULL;
34 GLubyte *where, *terminator;
36 /* Extension names should not have spaces. */
37 where = (GLubyte *) strchr(extension, ' ');
38 if (where || *extension == '\0')
40 extensions = glGetString(GL_EXTENSIONS);
41 /* It takes a bit of care to be fool-proof about parsing the
42 OpenGL extensions string. Don't be fooled by sub-strings,
46 where = (GLubyte *) strstr((const char *) start, extension);
49 terminator = where + strlen(extension);
50 if (where == start || *(where - 1) == ' ')
51 if (*terminator == ' ' || *terminator == '\0')
58 gboolean hasRequiredGLExtensions( )
63 for( i=0; required_extensions[i] != NULL; i++ ) {
64 if( !isGLExtensionSupported(required_extensions[i]) ) {
65 ERROR( "Required OpenGL extension not supported: %s", required_extensions[i] );
.