Here is another GLSL code sample from my project. This one was fairly easy after they gave us the formula to use. Here is the code and image of the results.
Vert Shader
uniform sampler2D my_color_texture; uniform float time; varying vec2 texc; void main() { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; texc = vec2(gl_MultiTexCoord0); }
Frag Shader
varying vec2 texc; uniform sampler2D my_color_texture; uniform float time; const float A = 0.03; const float B = 200.0; const float C = 5.0; const float D = 0.003; const float E = 13.0; const float F = 9.0; float x; float y; void main() { gl_FragColor = texture2D(my_color_texture, texc); gl_FragColor.a = 1.0; //Best to make sure nothing seems transparent float x = A * sin(B * texc.x) * sin(C * time); float y = D * sin(E * texc.y) * sin(F * time); vec2 c = vec2(texc.x + x, texc.y +y); vec4 diffuse_color = texture2D(my_color_texture, c); gl_FragColor = diffuse_color; }
Mess with the variables to get different affects.