texture2DLod() can't be found
I'm trying to avoid seams when tiling a surface with textures from texture atlas (the problem and possible solution can be found here: http://mtnphil.wordpress.com/2011/09/22/terrain-engine/)
I need to manually calculate mipmap level in GLSLES fragment shader and thus use texture2DLod() function.
Here is my fragment shader:
#extension GL_OES_standard_derivatives : enable
precision mediump float;
varying vec2 vUV0;
uniform sampler2D textureA;
float mipmapLevel(in vec2 coords, in vec2 texSize)
vec2 coordInPix = coords * texSize;
vec2 dx = dFdx(coordInPix);
vec2 dy = dFdy(coordInPix);
float d = max(dot(dx, dx), dot(dy, dy));
return 0.4 * log2(d);
vec2 uv = vUV0;
// wrapping the coordinates
uv = fract(uv);
// recalculating them into atlas
uv = 64.0/512.0 + uv*128.0/512.0;;
float lod = mipmapLevel(uv, vec2(512.0, 512.0));
colorOut = texture2DLod(textureA, uv, lod);
gl_FragColor = colorOut;
I'm getting the following error message from shader compiler: " 'texture2DLod' : no matching overloaded function found "
According to my googling, texture2DLod can be used in fragment shader (though OGL specs say it should be used only in vertex shader - maybe a misprint).
I've tried defining extensions such as GL_EXT_shader_texture_lod, but none of them are accepted by the shader compiler.
Did I go wrong somewhere, or texture2DLod() is just supported by a narrow range of hardware?
My videocard is GeForce N210, also I tried my app on Samsung GalaxyTab with no result.