diff options
author | Zack Rusin <zack@kde.org> | 2010-05-15 00:58:02 -0400 |
---|---|---|
committer | Zack Rusin <zack@kde.org> | 2010-05-15 00:58:43 -0400 |
commit | b93fa7e2e807271dd51b9c4ec47b2f86311a61a8 (patch) | |
tree | b230a01cfa20e98f07caa00a4847b8d7fe24e736 /progs/vpglsl/func.glsl | |
parent | 4e84dc8729cac4c78e521436ae091638a490da76 (diff) |
vpglsl: add some simple tests with function calls
Diffstat (limited to 'progs/vpglsl/func.glsl')
-rw-r--r-- | progs/vpglsl/func.glsl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/progs/vpglsl/func.glsl b/progs/vpglsl/func.glsl new file mode 100644 index 0000000000..05539880fd --- /dev/null +++ b/progs/vpglsl/func.glsl @@ -0,0 +1,33 @@ +#version 120 +const int KernelSize = 16; +uniform float KernelValue1f[KernelSize]; + + +float add_two(float a, float b) +{ + if (a > b) + return a - b; + else + return a + b; +} + +vec4 func(vec4 x) +{ + int i; + vec4 tmp = gl_Color; + vec4 sum = x; + + for (i = 0; i < KernelSize; ++i) { + sum = vec4( add_two(sum.x, KernelValue1f[i]) ); + } + return sum; +} + +void main(void) +{ + vec4 sum = vec4(0.0); + + sum = func(sum); + gl_Position = gl_Vertex; + gl_FrontColor = sum; +} |