added test for ARB GLSL extensions
authorCorbin Simpson <mostawesomedude@gmail.com>
Sat, 16 Aug 2008 17:07:51 +0000 (11:07 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 16 Aug 2008 17:07:51 +0000 (11:07 -0600)
progs/util/shaderutil.c

index 477209ab45f5d4a41312ae29cb0bbec3002608c6..4f17dd7efa15ae8fefdaac1b90338a56956b5ab0 100644 (file)
@@ -27,12 +27,15 @@ Init(void)
 GLboolean
 ShadersSupported(void)
 {
-   const char *version;
-
-   version = (const char *) glGetString(GL_VERSION);
-   if (version[0] != '2' || version[1] != '.') {
-      printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
-      return GL_FALSE;
+   const char *version = (const char *) glGetString(GL_VERSION);
+   if (version[0] == '2' && version[1] == '.') {
+      return GL_TRUE;
+   }
+   else if (glutExtensionSupported("GL_ARB_vertex_shader")
+            && glutExtensionSupported("GL_ARB_fragment_shader")
+            && glutExtensionSupported("GL_ARB_shader_objects")) {
+      fprintf(stderr, "Warning: Trying ARB GLSL instead of OpenGL 2.x.  This may not work.\n");
+      return GL_TRUE;
    }
    return GL_TRUE;
 }