summaryrefslogtreecommitdiff
path: root/progs/vpglsl/func.glsl
blob: 05539880fd849ab9058a5a70036c9eb083cbdf57 (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
#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;
}