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.

  • \$\begingroup\$ Did you forget to declare float precision at the top of the fragment shader? precision mediump float; \$\endgroup\$
    – TenFour04
    Commented Mar 25, 2016 at 19:26

1 Answer 1


"offset" is not declared. Not sure why it would compile anywhere else, I doubt it.

  • \$\begingroup\$ The thing is, I actually cleaned up the shader (as I converted it from Java String to Kotlin multiline String) and by the looks of it I removed the offset in the process.. thank you. Do you (or anyone else) have ideas why the log might return an empty string? \$\endgroup\$
    – user38725
    Commented Mar 8, 2016 at 11:08
  • \$\begingroup\$ OK, after removing the offset completely the Shader works flawlessly on desktop. Any ideas why it doesn't work on Android (5.0)? This is kind of difficult to debug without the log :( \$\endgroup\$
    – user38725
    Commented Mar 8, 2016 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .