Added support for shaders written in non-legacy GLSL.

This commit is contained in:
binary1248 2018-05-20 14:06:24 +02:00
parent 1dcad60878
commit db7e683688
No known key found for this signature in database
GPG key ID: E5E52A5D6082224A
18 changed files with 690 additions and 74 deletions

View file

@ -1,20 +1,23 @@
uniform sampler2D texture;
uniform float blur_radius;
varying vec4 texCoord;
varying vec4 frontColor;
void main()
{
vec2 offx = vec2(blur_radius, 0.0);
vec2 offy = vec2(0.0, blur_radius);
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 4.0 +
texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy + offx) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy - offy) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;
vec4 pixel = texture2D(texture, texCoord.xy) * 4.0 +
texture2D(texture, texCoord.xy - offx) * 2.0 +
texture2D(texture, texCoord.xy + offx) * 2.0 +
texture2D(texture, texCoord.xy - offy) * 2.0 +
texture2D(texture, texCoord.xy + offy) * 2.0 +
texture2D(texture, texCoord.xy - offx - offy) * 1.0 +
texture2D(texture, texCoord.xy - offx + offy) * 1.0 +
texture2D(texture, texCoord.xy + offx - offy) * 1.0 +
texture2D(texture, texCoord.xy + offx + offy) * 1.0;
gl_FragColor = gl_Color * (pixel / 16.0);
gl_FragColor = frontColor * (pixel / 16.0);
}