1#version 120 2const int KernelSize = 16; 3uniform float KernelValue1f[KernelSize]; 4 5 6float add_two(float a, float b) 7{ 8 if (a > b) 9 return a - b; 10 else 11 return a + b; 12} 13 14vec4 func(vec4 x) 15{ 16 int i; 17 vec4 tmp = gl_Color; 18 vec4 sum = x; 19 20 for (i = 0; i < KernelSize; ++i) { 21 sum = vec4( add_two(sum.x, KernelValue1f[i]) ); 22 } 23 return sum; 24} 25 26void main(void) 27{ 28 vec4 sum = vec4(0.0); 29 30 sum = func(sum); 31 gl_Position = gl_Vertex; 32 gl_FrontColor = sum; 33} 34