Fixed shader examples

This commit is contained in:
Marco Antognini 2011-05-15 13:36:13 +02:00
parent 0f2fb0e2f6
commit 0e826d8dec
2 changed files with 10 additions and 10 deletions

View File

@ -6,15 +6,15 @@ void main()
vec2 offx = vec2(offset, 0.0); vec2 offx = vec2(offset, 0.0);
vec2 offy = vec2(0.0, offset); vec2 offy = vec2(0.0, offset);
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 1 + vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy - offx) * 2 + texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy + offx) * 2 + texture2D(texture, gl_TexCoord[0].xy + offx) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy - offy) * 2 + texture2D(texture, gl_TexCoord[0].xy - offy) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy + offy) * 2 + texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 +
texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1 + texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1 + texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1 + texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1; texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;
gl_FragColor = gl_Color * (pixel / 13.0); gl_FragColor = gl_Color * (pixel / 13.0);
} }

View File

@ -3,7 +3,7 @@ uniform vec2 mouse;
void main() void main()
{ {
float factor = 5 + 100 * length(mouse); float factor = 5.0 + 100.0 * length(mouse);
vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor; vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor;
gl_FragColor = texture2D(texture, pos) * gl_Color; gl_FragColor = texture2D(texture, pos) * gl_Color;