source: osgVisual/trunk/resources/distortion/shader.frag @ 264

Last change on this file since 264 was 147, checked in by Torben Dannhauer, 14 years ago
File size: 567 bytes
Line 
1uniform sampler2D textureImage;
2uniform sampler2D textureDistort;
3uniform sampler2D textureBlend;
4
5void main()
6{
7    vec4 texCoord;
8    vec4 distortColor;
9    vec4 blendColor;
10
11    distortColor = texture2D(textureDistort, gl_TexCoord[0].st);
12    blendColor = texture2D(textureBlend, gl_TexCoord[0].st);
13
14    texCoord.s = (distortColor.b + mod(floor(distortColor.r * 255.5), 16.0)) / 16.0;
15    texCoord.t = 1.0 - (distortColor.g + floor(distortColor.r * 255.5 / 16.0)) / 16.0;
16
17    gl_FragColor = texture2D(textureImage, texCoord.st) * blendColor;
18}
Note: See TracBrowser for help on using the repository browser.