From a4dcdcf0ffae4c6cf52354fbd63c95d7d7815fd9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Aug 1999 13:57:42 +0000 Subject: initial check-in (post crash) --- src/glut/glx/glut_ext.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 src/glut/glx/glut_ext.c (limited to 'src/glut/glx/glut_ext.c') diff --git a/src/glut/glx/glut_ext.c b/src/glut/glx/glut_ext.c new file mode 100644 index 0000000000..abcb17a911 --- /dev/null +++ b/src/glut/glx/glut_ext.c @@ -0,0 +1,53 @@ + +/* Copyright (c) Mark J. Kilgard, 1994, 1997. */ + +/* This program is freely distributable without licensing fees + and is provided without guarantee or warrantee expressed or + implied. This program is -not- in the public domain. */ + +#include +#include + +#include "glutint.h" + +/* CENTRY */ +int APIENTRY +glutExtensionSupported(const char *extension) +{ + static const GLubyte *extensions = NULL; + const GLubyte *start; + GLubyte *where, *terminator; + + /* Extension names should not have spaces. */ + where = (GLubyte *) strchr(extension, ' '); + if (where || *extension == '\0') + return 0; + + if (!extensions) { + extensions = glGetString(GL_EXTENSIONS); + } + /* It takes a bit of care to be fool-proof about parsing the + OpenGL extensions string. Don't be fooled by sub-strings, + etc. */ + start = extensions; + for (;;) { + /* If your application crashes in the strstr routine below, + you are probably calling glutExtensionSupported without + having a current window. Calling glGetString without + a current OpenGL context has unpredictable results. + Please fix your program. */ + where = (GLubyte *) strstr((const char *) start, extension); + if (!where) + break; + terminator = where + strlen(extension); + if (where == start || *(where - 1) == ' ') { + if (*terminator == ' ' || *terminator == '\0') { + return 1; + } + } + start = terminator; + } + return 0; +} + +/* ENDCENTRY */ -- cgit v1.2.3