[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [10859] branches/soc-2007-maike/source/ blender: GLSL support checking

Miguel Torres Lima torreslima at gmail.com
Sat Jun 2 17:47:24 CEST 2007


Revision: 10859
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=10859
Author:   maike
Date:     2007-06-02 17:47:23 +0200 (Sat, 02 Jun 2007)

Log Message:
-----------
GLSL support checking

Modified Paths:
--------------
    branches/soc-2007-maike/source/blender/include/BIF_glutil.h
    branches/soc-2007-maike/source/blender/src/glutil.c

Modified: branches/soc-2007-maike/source/blender/include/BIF_glutil.h
===================================================================
--- branches/soc-2007-maike/source/blender/include/BIF_glutil.h	2007-06-02 13:46:16 UTC (rev 10858)
+++ branches/soc-2007-maike/source/blender/include/BIF_glutil.h	2007-06-02 15:47:23 UTC (rev 10859)
@@ -221,5 +221,9 @@
 } bglMats;
 void bgl_get_mats(bglMats *mats);
 
+/* GLSL Support */
+int init_glsl(void);
+int has_glsl_support(void);
+
 #endif /* BIF_GLUTIL_H */
 

Modified: branches/soc-2007-maike/source/blender/src/glutil.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glutil.c	2007-06-02 13:46:16 UTC (rev 10858)
+++ branches/soc-2007-maike/source/blender/src/glutil.c	2007-06-02 15:47:23 UTC (rev 10859)
@@ -682,3 +682,43 @@
 }
 
 
+
+
+/****************/
+/* GLSL support */
+/****************/
+
+static int hasGLSL = -1;
+
+
+static void check_glsl_support(void)
+{
+  const unsigned char *gl_extensions;
+  char *v_ext = "GL_ARB_vertex_program";
+  char *f_ext = "GL_ARB_fragment_program";
+
+  gl_extensions = glGetString(GL_EXTENSIONS);
+
+  if(strstr((char *) gl_extensions, v_ext) != NULL && strstr((char *) gl_extensions, f_ext) != NULL){
+    hasGLSL = 1;
+    
+    glsl_init_material_programs();
+  }
+  else
+    hasGLSL = 0;
+}
+
+
+int init_glsl(void)
+{
+  if(hasGLSL == -1)
+    check_glsl_support();
+
+  return 0;
+}
+
+
+int has_glsl_support(void)
+{
+  return hasGLSL;
+}





More information about the Bf-blender-cvs mailing list