I'm trying to get a "ripple"-shader working for OpenGL ES 2.0+ (using LibGDX).
However, I can't get it to compile, and for some reason ShaderProgram.getLog()
returns an empty string even though the Shader didn't compile.
I am 100% confident that the vertex shader is correct.. here's the fragment shader (not written by me, but I modified it a bit long time ago.. when I had a desktop project - and it worked back then):
#version 120
precision mediump float;
varying vec2 v_texCoords;
uniform float time;
uniform float alpha;
uniform float waveLengthMultiplier;
uniform sampler2D u_texture;
void main()
{
vec2 center = vec2(0.5, 0.5);
vec2 tc = v_texCoords.xy;
vec2 p = -1.0 + 2.0 * (tc - offset);
float len = length(p) * waveLengthMultiplier;
vec2 uv = tc + (p / len) * cos(len * 12.0 - time * 4.0) * 0.03;
vec3 col = texture2D(u_texture, uv).xyz;
gl_FragColor = vec4(col, alpha);
}
I'm still not very well-versed with shaders, as I've used them only a little.. Like I said, getLog()
returns an empty string, so I'm hoping someone spots an error in the code.
precision mediump float;
\$\endgroup\$