summaryrefslogtreecommitdiff
path: root/progs/vpglsl
diff options
context:
space:
mode:
authorZack Rusin <zack@tungstengraphics.com>2007-10-25 07:52:59 -0400
committerZack Rusin <zack@tungstengraphics.com>2007-10-25 09:04:41 -0400
commit1d26e9c447fd9746b2219edbf65b1991521bcfe7 (patch)
treeb590bb2bbbe9ce240c55981a9ed559d407cc4055 /progs/vpglsl
parente842b5e5ba738cd214137cca95c6da64492f9f92 (diff)
Fix nested conditionals
Diffstat (limited to 'progs/vpglsl')
-rw-r--r--progs/vpglsl/nestedifs.glsl13
-rw-r--r--progs/vpglsl/nestedswizzle.glsl9
-rw-r--r--progs/vpglsl/vp-tris.c2
3 files changed, 23 insertions, 1 deletions
diff --git a/progs/vpglsl/nestedifs.glsl b/progs/vpglsl/nestedifs.glsl
new file mode 100644
index 0000000000..abb235cd65
--- /dev/null
+++ b/progs/vpglsl/nestedifs.glsl
@@ -0,0 +1,13 @@
+
+void main() {
+ gl_Position = gl_Vertex;
+ if (gl_Position.x < 0.5) {
+ if (gl_Position.y < 0.20) {
+ gl_FrontColor = vec4(1.0, 0.0, 0.0, 1.0);
+ } else {
+ gl_FrontColor = vec4(0.0, 1.0, 0.0, 1.0);
+ }
+ gl_FrontColor.y = 1.0;
+ } else
+ gl_FrontColor = gl_Color;
+}
diff --git a/progs/vpglsl/nestedswizzle.glsl b/progs/vpglsl/nestedswizzle.glsl
new file mode 100644
index 0000000000..a3adb3dfeb
--- /dev/null
+++ b/progs/vpglsl/nestedswizzle.glsl
@@ -0,0 +1,9 @@
+
+void main() {
+ gl_Position = gl_Vertex;
+ gl_FrontColor = gl_Color;
+ if (gl_Position.x < 0.5) {
+ gl_FrontColor.y = 1.0;
+ }
+ gl_FrontColor.xzw = vec3(0, 0, 1);
+}
diff --git a/progs/vpglsl/vp-tris.c b/progs/vpglsl/vp-tris.c
index 1d1b639b56..3c2830773a 100644
--- a/progs/vpglsl/vp-tris.c
+++ b/progs/vpglsl/vp-tris.c
@@ -54,7 +54,7 @@ static void read_shader(GLuint shader, const char *filename)
}
n = fread(buffer, 1, max, f);
- printf("fslight: read %d bytes from shader file %s\n", n, filename);
+ printf("vp-tris: read %d bytes from shader file %s\n", n, filename);
if (n > 0) {
buffer[n] = 0;
load_and_compile_shader(shader, buffer);