Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //VERTEX
- #ifdef GL_ES
- #define MED mediump
- #else
- #define MED
- #endif
- attribute vec4 a_position;
- attribute vec2 a_texCoord0;
- uniform vec2 dir;
- uniform vec2 size;
- varying MED vec2 v_texCoords0;
- varying MED vec2 v_texCoords1;
- varying MED vec2 v_texCoords2;
- varying MED vec2 v_texCoords3;
- varying MED vec2 v_texCoords4;
- const vec2 futher = vec2(3.2307692308, 3.2307692308);
- const vec2 closer = vec2(1.3846153846, 1.3846153846);
- void main()
- {
- vec2 sizeAndDir = dir / size;
- vec2 f = futher * sizeAndDir;
- vec2 c = closer * sizeAndDir;
- v_texCoords0 = a_texCoord0 - f;
- v_texCoords1 = a_texCoord0 - c;
- v_texCoords2 = a_texCoord0;
- v_texCoords3 = a_texCoord0 + c;
- v_texCoords4 = a_texCoord0 + f;
- gl_Position = a_position;
- }
- //FRAGMENT
- #ifdef GL_ES
- #define MED mediump
- precision mediump float; //change to lowp to get blazing fast shader but with some glitches may occur
- #else
- #define MED
- #endif
- uniform sampler2D u_texture;
- varying MED vec2 v_texCoords0;
- varying MED vec2 v_texCoords1;
- varying MED vec2 v_texCoords2;
- varying MED vec2 v_texCoords3;
- varying MED vec2 v_texCoords4;
- const float center = 0.2270270270;
- const float close = 0.3162162162;
- const float far = 0.0702702703;
- void main()
- {
- gl_FragColor.rgb = far * texture2D(u_texture, v_texCoords0).rgb
- + close * texture2D(u_texture, v_texCoords1).rgb
- + center * texture2D(u_texture, v_texCoords2).rgb
- + close * texture2D(u_texture, v_texCoords3).rgb
- + far * texture2D(u_texture, v_texCoords4).rgb;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement