From 1d26e9c447fd9746b2219edbf65b1991521bcfe7 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 25 Oct 2007 07:52:59 -0400 Subject: Fix nested conditionals --- progs/vpglsl/nestedifs.glsl | 13 +++++++++++++ progs/vpglsl/nestedswizzle.glsl | 9 +++++++++ progs/vpglsl/vp-tris.c | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 progs/vpglsl/nestedifs.glsl create mode 100644 progs/vpglsl/nestedswizzle.glsl (limited to 'progs/vpglsl') 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); -- cgit v1.2.3