Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
glut_ext.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <string.h>
00009
00010 #include <GL/glut.h>
00011 #include "glutint.h"
00012
00013 int
00014 glutExtensionSupported(char *extension)
00015 {
00016 static const GLubyte *extensions = NULL;
00017 const GLubyte *start;
00018 GLubyte *where, *terminator;
00019
00020
00021 where = (GLubyte *) strchr(extension, ' ');
00022 if (where || *extension == '\0')
00023 return 0;
00024
00025 if (!extensions)
00026 extensions = glGetString(GL_EXTENSIONS);
00027
00028
00029
00030 start = extensions;
00031 for (;;) {
00032 where = (GLubyte *) strstr((const char *)start, extension);
00033 if (!where)
00034 break;
00035 terminator = where + strlen(extension);
00036 if (where == start || *(where - 1) == ' ') {
00037 if (*terminator == ' ' || *terminator == '\0') {
00038 return 1;
00039 }
00040 }
00041 start = terminator;
00042 }
00043 return 0;
00044 }
00045
00046 int
00047 __glutIsSupportedByGLX(char *extension)
00048 {
00049 #if defined(GLX_VERSION_1_1)
00050 static const char *extensions = NULL;
00051 const char *start;
00052 char *where, *terminator;
00053 int major, minor;
00054
00055 glXQueryVersion(__glutDisplay, &major, &minor);
00056
00057
00058
00059
00060 if ((major == 1 && minor >= 1) || (major > 1)) {
00061 if (!extensions)
00062 extensions = glXQueryExtensionsString(__glutDisplay, __glutScreen);
00063
00064
00065
00066 start = extensions;
00067 for (;;) {
00068 where = strstr(start, extension);
00069 if (!where)
00070 return 0;
00071 terminator = where + strlen(extension);
00072 if (where == start || *(where - 1) == ' ') {
00073 if (*terminator == ' ' || *terminator == '\0') {
00074 return 1;
00075 }
00076 }
00077 start = terminator;
00078 }
00079 }
00080 #else
00081
00082 #endif
00083 return 0;
00084 }
00085