Here is code, that i used:
ShaderEffect {
id: shader
...
<some code>
....
fragmentShader: "
#define M_PI 3.1415926535897932384626433832795
varying highp vec2 qt_TexCoord0;
uniform lowp sampler2D source;
uniform highp float range;
uniform highp float maxRange;
uniform highp float cX;
uniform highp float cY;
uniform highp float depth;
uniform highp float shift;
float f(float x)
{
return -sin(x/M_PI*10);
}
void main() {
highp float x = qt_TexCoord0.x - cX;
highp float y = qt_TexCoord0.y - cY;
highp float r = sqrt( pow(y, 2) + pow(x, 2) );
if ( r < (range - depth) || r > (range + depth) ) return;
highp float ang;
highp float dr;
ang = atan(y/x);
if (x < 0) ang += M_PI;
highp float k = (r - range) / depth;
dr = f(k) * depth * shift * (1 - (r/maxRange));
highp float dx = dr * cos(ang);
highp float dy = dr * sin(ang);
highp vec4 texpixel = texture2D( source, vec2( qt_TexCoord0.x + 0, qt_TexCoord0.y + dy ) );
gl_FragColor = texpixel;
}
"
}
Can i use it on android? or what i need to use istead of it?
↧