|
- [vert.glsl]
-
- #version 120
-
- attribute vec4 in_Position;
- varying vec2 pass_TexCoord;
-
- void main()
- {
- gl_Position = in_Position;
- pass_TexCoord = vec2(0.5, 0.5) + 0.5 * in_Position.xy;
- }
-
- [frag.glsl]
-
- #version 120
-
- varying vec2 pass_TexCoord;
-
- uniform sampler2D texture;
- uniform vec2 radius;
-
- void main(void)
- {
- vec4 total = vec4(0.0);
- vec2 p = pass_TexCoord;
- float mask = 2.0-p.x*(6.0-p.x*6.0)*p.y*(6.0-p.y*6.0);
- float b = radius.x+radius.y*mask;
- total += texture2D(texture,vec2(p.x-b*4.0,p.y))*0.04;
- total += texture2D(texture,vec2(p.x-b*3.0,p.y))*0.08;
- total += texture2D(texture,vec2(p.x-b*2.0,p.y))*0.12;
- total += texture2D(texture,vec2(p.x-b ,p.y))*0.16;
- total += texture2D(texture,vec2(p.x ,p.y))*0.20;
- total += texture2D(texture,vec2(p.x+b ,p.y))*0.16;
- total += texture2D(texture,vec2(p.x+b*2.0,p.y))*0.12;
- total += texture2D(texture,vec2(p.x+b*3.0,p.y))*0.08;
- total += texture2D(texture,vec2(p.x+b*4.0,p.y))*0.04;
- gl_FragColor = total;
- }
|