2 /* Copyright (c) Mark J. Kilgard, 1994, 1997. */
4 /* This program is freely distributable without licensing fees
5 and is provided without guarantee or warrantee expressed or
6 implied. This program is -not- in the public domain. */
15 glutExtensionSupported(const char *extension
)
17 static const GLubyte
*extensions
= NULL
;
19 GLubyte
*where
, *terminator
;
21 /* Extension names should not have spaces. */
22 where
= (GLubyte
*) strchr(extension
, ' ');
23 if (where
|| *extension
== '\0')
27 extensions
= glGetString(GL_EXTENSIONS
);
29 /* It takes a bit of care to be fool-proof about parsing the
30 OpenGL extensions string. Don't be fooled by sub-strings,
34 /* If your application crashes in the strstr routine below,
35 you are probably calling glutExtensionSupported without
36 having a current window. Calling glGetString without
37 a current OpenGL context has unpredictable results.
38 Please fix your program. */
39 where
= (GLubyte
*) strstr((const char *) start
, extension
);
42 terminator
= where
+ strlen(extension
);
43 if (where
== start
|| *(where
- 1) == ' ') {
44 if (*terminator
== ' ' || *terminator
== '\0') {