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

Last change on this file since 320 was 298, checked in by Torben Dannhauer, 13 years ago
File size: 759 bytes
RevLine 
[147]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
[298]14// modified
15//    texCoord.s = (distortColor.b / 255.0 + mod(distortColor.r , 16.0)) / 16.0;
16//    texCoord.t = 1.0 - (distortColor.g / 255.0 + (distortColor.r / 16.0)) / 16.0;
[147]17
[298]18// Original
19texCoord.s = (distortColor.b + mod(floor(distortColor.r * 255.5), 16.0)) / 16.0;
20texCoord.t = 1.0 - (distortColor.g + floor(distortColor.r * 255.5 / 16.0)) / 16.0;
21
[147]22    gl_FragColor = texture2D(textureImage, texCoord.st) * blendColor;
23}
[298]24
25
Note: See TracBrowser for help on using the repository browser.