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:34:13 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:34:13 (GMT)
commit67ad0519fd165acee4a4d2a94fa502e9e4847bd0 (patch)
tree1dbf50b3dff8d5ca7e9344733968c72704eb15ff /src/opengl/util/glsl_to_include.sh
downloadQt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.zip
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.gz
Qt-67ad0519fd165acee4a4d2a94fa502e9e4847bd0.tar.bz2
Long live Qt!
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