fpglsl: add some for and while loops
authorZack Rusin <zack@kde.org>
Wed, 10 Mar 2010 20:37:18 +0000 (15:37 -0500)
committerZack Rusin <zack@kde.org>
Wed, 10 Mar 2010 20:37:18 +0000 (15:37 -0500)
progs/fpglsl/for.glsl [new file with mode: 0644]
progs/fpglsl/while.glsl [new file with mode: 0644]

diff --git a/progs/fpglsl/for.glsl b/progs/fpglsl/for.glsl
new file mode 100644 (file)
index 0000000..6aa03d6
--- /dev/null
@@ -0,0 +1,11 @@
+uniform int KernelSizeInt;
+
+void main() {
+    int i;
+    vec4 sum = vec4(0.0);
+    for (i = 0; i < KernelSizeInt; ++i) {
+       sum.g += 0.25;
+    }
+    sum.a = 1;
+    gl_FragColor = sum;
+}
diff --git a/progs/fpglsl/while.glsl b/progs/fpglsl/while.glsl
new file mode 100644 (file)
index 0000000..05fb860
--- /dev/null
@@ -0,0 +1,7 @@
+void main() {
+    float sum = 0.0;
+    while (sum < 0.499999) {
+       sum += 0.1;
+    }
+    gl_FragColor = vec4(sum);
+}