summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/glsl_to_include.sh
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /src/opengl/util/glsl_to_include.sh
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'src/opengl/util/glsl_to_include.sh')
-rwxr-xr-xsrc/opengl/util/glsl_to_include.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/opengl/util/glsl_to_include.sh b/src/opengl/util/glsl_to_include.sh
new file mode 100755
index 0000000..59d4693
--- /dev/null
+++ b/src/opengl/util/glsl_to_include.sh
@@ -0,0 +1,33 @@
+#! /bin/sh
+
+# Compile a .glsl file to a file that can be included in a C++ program
+USAGE="Usage: $0 <file.glsl>"
+CGC=cgc
+CGC_PROFILE=arbfp1
+
+if test $# -ne 1
+then
+ echo $USAGE
+ exit 1
+fi
+
+GLSL_FILE=$1
+FRAG_FILE=`basename $1 .glsl`.frag
+#GLSL_INC_FILE=`basename $1 .glsl`.glsl_quoted
+
+echo "// Generated by src/opengl/util/$0 from $1" > $FRAG_FILE
+$CGC -quiet -oglsl -profile $CGC_PROFILE $GLSL_FILE | while read line
+do
+ if test `echo $line | cut -c1` != "#"
+ then
+ echo -e \"$line\" >> $FRAG_FILE
+ fi
+done
+echo "; // Generated by src/opengl/util/$0 from $1" >> $FRAG_FILE
+
+#echo "// Generated by src/opengl/util/$0 from $1" > $GLSL_INC_FILE
+#cat $GLSL_FILE | while read line
+#do
+# printf \"%s\\\\n\"\\n "$line" >> $GLSL_INC_FILE
+#done
+#echo "; // Generated by src/opengl/util/$0 from $1" >> $GLSL_INC_FILE