summaryrefslogtreecommitdiffstats
path: root/src/opengl/util/glsl_to_include.sh
blob: 59d4693c3c326644a69ae46e90173c13f7980537 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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