Search
lxdream.org :: lxdream/src/pvr2/glutil.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/pvr2/glutil.c
changeset 635:76c63aac3590
next636:2ccf94f966fc
author nkeynes
date Thu Feb 14 13:54:11 2008 +0000 (13 years ago)
branchlxdream-render
permissions -rw-r--r--
last change Commit render work in progress. Main changes:
* Preliminary OSMesa support
* Move the generic gl code out to pvr2/
* Implement scene data structure + reader
* Remove the 1/z adjustments
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/pvr2/glutil.c Thu Feb 14 13:54:11 2008 +0000
1.3 @@ -0,0 +1,52 @@
1.4 +/**
1.5 + * $Id: glutil.c 602 2008-01-15 20:50:23Z nkeynes $
1.6 + *
1.7 + * GL-based support functions
1.8 + *
1.9 + * Copyright (c) 2005 Nathan Keynes.
1.10 + *
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.15 + *
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.20 + */
1.21 +
1.22 +#include "pvr2/glutil.h"
1.23 +
1.24 +/**
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.28 + */
1.29 +gboolean isGLExtensionSupported( const char *extension )
1.30 +{
1.31 + const GLubyte *extensions = NULL;
1.32 + const GLubyte *start;
1.33 + GLubyte *where, *terminator;
1.34 +
1.35 + /* Extension names should not have spaces. */
1.36 + where = (GLubyte *) strchr(extension, ' ');
1.37 + if (where || *extension == '\0')
1.38 + return 0;
1.39 + extensions = glGetString(GL_EXTENSIONS);
1.40 + /* It takes a bit of care to be fool-proof about parsing the
1.41 + OpenGL extensions string. Don't be fooled by sub-strings,
1.42 + etc. */
1.43 + start = extensions;
1.44 + for (;;) {
1.45 + where = (GLubyte *) strstr((const char *) start, extension);
1.46 + if (!where)
1.47 + break;
1.48 + terminator = where + strlen(extension);
1.49 + if (where == start || *(where - 1) == ' ')
1.50 + if (*terminator == ' ' || *terminator == '\0')
1.51 + return TRUE;
1.52 + start = terminator;
1.53 + }
1.54 + return FALSE;
1.55 +}
.