[Galaxy S II Q&A, Help & Troubleshooting] jarari2:
Hi, I'm trying to get ink effect without s-pen.

I got preference back, setting is working, and modified policy to connect to JNIripple, but it doens't work.

I think it needs .so file edited, but I don't know any of it, so I'm asking here.

Plz take a look at this code and find where to edit.

Thanks

attribute vec4 vertex;
.void main().{. gl_Position = vertex;
.}........precision mediump float;
.uniform sampler2D Velocity;
.uniform vec2 Scale;
.uniform vec2 VelocityGridInverseSize;
.uniform float HalfInverseCellSize;
.uniform float force;
.uniform float radius;
.uniform vec2 Point;
.vec2 encode(float v).{..const vec2 mask = vec2(1.0, 255.0);
. v *= 0.001;
..v += 0.498039;
..vec2 p = fract(v*mask);
..p.x -= p.y/255.0;
..return p;
.}.float decode(vec2 v).{..return v.x*255.0 + v.y -127.0;
.}.void main().{. vec2 T = gl_FragCoord.xy*VelocityGridInverseSize;
. vec4 buf;
. buf = texture2D(Velocity, T+vec2(0.0, VelocityGridInverseSize.y));
. vec2 vN = vec2( decode(buf.xy), decode(buf.zw) );
. buf = texture2D(Velocity, T+vec2(0.0, -VelocityGridInverseSize.y));
. vec2 vS = vec2( decode(buf.xy), decode(buf.zw) );
. buf = texture2D(Velocity, T+vec2(VelocityGridInverseSize.x, 0.0));
. vec2 vE = vec2( decode(buf.xy), decode(buf.zw) );
. buf = texture2D(Velocity, T+vec2(-VelocityGridInverseSize.x, 0.0));
. vec2 vW = vec2( decode(buf.xy), decode(buf.zw) );
. float div = HalfInverseCellSize * (vE.x - vW.x + vN.y - vS.y);
. float d = distance(Point, Scale*gl_FragCoord.xy);
. if( d < radius ) div -= force;
//*(1.0+d);
. gl_FragColor.xy = encode(div);
.}........precision mediump float;
.uniform sampler2D Source;
.uniform vec2 Scale;
.uniform vec2 DensityGridInverseSize;
.uniform vec2 current;
.uniform vec2 previous;
.uniform vec2 normal;
.uniform int mode;
.uniform float len;
.uniform float ImpulseDensity;
.uniform float Radius;
.vec2 encode(float v).{. v = clamp(v, -127.0, 127.0);
. vec2 p;
. p.x = fract(v/255.0);
. p.y = fract(v);
. p.x -= p.y/255.0;
.. return p;
.}.void main().{. vec4 buf = texture2D(Source, gl_FragCoord.xy * DensityGridInverseSize);
. float x = 255.0*buf.x + buf.y;
. vec2 p = Scale*gl_FragCoord.xy;
. if(mode==1). {. .float d = distance(current, p);
. .if( d < Radius ) x += ImpulseDensity/(1.0+d);
. } . else if(mode==2). {. vec2 vector = p - previous;
. float dot_val = dot( normal, vector );
. if( dot_val > 0.0 && dot_val < len ). {. vec2 projected = previous + dot_val*normal;
. ..float d = distance(projected, p);
. . if( d < Radius ) x += ImpulseDensity*exp(-d*d/(0.8*Radius*Radius));
. }. }. else. {. .float d = distance(current, p);
. .if( d < Radius ) x += ImpulseDensity/(1.0+d);
. } . gl_FragColor.xy = encode(x);
.}....precision mediump float;
.uniform sampler2D VelocityTexture;
.uniform sampler2D SourceTexture;
.uniform vec2 VelocityGridInverseSize;
.uniform vec2 Scale;
.uniform float TimeStep;
.uniform float Dissipation;
.uniform vec2 center;
.uniform vec2 force;
.uniform int drag;
.uniform int switches;
.vec2 encode(float v).{..const vec2 mask = vec2(0.00392157, 1.0);
..v = clamp(v, -127.0, 127.0);
..v += 127.0;
..vec2 p = fract(v*mask);
..p.x -= p.y/255.0;
..return p;
.}.void main().{. vec2 fragCoord = gl_FragCoord.xy;
. vec4 buf = texture2D(VelocityTexture, VelocityGridInverseSize * fragCoord);
. vec2 u;
. u.x = 255.0*buf.x + buf.y - 127.0;
. u.y = 255.0*buf.z + buf.w - 127.0;
. vec2 coord = VelocityGridInverseSize * (fragCoord - TimeStep * u);
. buf = texture2D(SourceTexture, coord);
. float temp;
. if(switches==0) temp = 126.97;
else temp = 126.96;
. u.x = 255.0*buf.x + buf.y - temp;
. u.y = 255.0*buf.z + buf.w - temp;
.. if( drag > 0 ){. .float d = distance(center, Scale*gl_FragCoord.xy);
. .if( d < 25.0 ) u += (float(drag)-1.5)*force;
.. }. gl_FragColor.xy = encode(Dissipation*u.x);
. gl_FragColor.zw = encode(Dissipation*u.y);
.}......precision mediump float;
.uniform sampler2D VelocityTexture;
.uniform sampler2D SourceTexture;
.uniform vec2 DensityGridInverseSize;
.uniform float TimeStep;
.uniform float BackwardStepSize;
.uniform float Dissipation;
.uniform vec2 Scale;
.uniform vec2 center;
.uniform int drag;
.vec2 encode(float v).{..const vec2 mask = vec2(0.00392157, 1.0);
..v = clamp(v, -127.0, 127.0);
..vec2 p = fract(v*mask);
..p.x -= p.y/255.0;
..return p;
.}.void main().{. vec2 fragCoord = gl_FragCoord.xy;
. vec4 buf = texture2D(VelocityTexture, DensityGridInverseSize * fragCoord);
. vec2 u;
. u.x = 255.0*buf.x + buf.y - 127.0;
. u.y = 255.0*buf.z + buf.w - 127.0;
. float back_step = BackwardStepSize;
.. if(drag<2){. .float d = distance(center, Scale*gl_FragCoord.xy);
. if( d < 80.0 ) back_step = 0.0075*d;
.. }. vec2 coord = DensityGridInverseSize*( fragCoord - back_step * TimeStep * u );
. buf = texture2D(SourceTexture, coord);
. float value = 255.0*buf.x + buf.y;
. gl_FragColor.xy = encode(Dissipation*value);
.}..precision mediump float;
.varying vec2 vTexture0Coord;
.varying vec2 vTexture1Coord;
.uniform sampler2D texture0;
.uniform sampler2D texture1;
.uniform float alphaRatio1;
.uniform float alphaRatio2;
.void main() {. vec4 tex0 = texture2D(texture0, vec2(vTexture0Coord.s, vTexture0Coord.t));
. vec4 tex1 = texture2D(texture1, vec2(vTexture1Coord.s, vTexture1Coord.t));
. vec3 rippleRGB = tex0.rgb * alphaRatio1 + tex1.rgb * alphaRatio2;
. gl_FragColor = vec4(rippleRGB, 1.0);
.}........precision mediump float;
.uniform sampler2D Density;
.varying vec2 vTexture0Coord;
.varying vec2 vTexture1Coord;
.uniform sampler2D texture0;
.uniform sampler2D texture1;
.uniform float alphaRatio1;
.uniform float alphaRatio2;
.uniform vec2 Scale;
.uniform float intensity;
.uniform vec3 ink_color;
.void main() {. vec4 tex0 = texture2D(texture0, vec2(vTexture0Coord.s, vTexture0Coord.t));
. vec4 tex1 = texture2D(texture1, vec2(vTexture1Coord.s, vTexture1Coord.t));
. vec3 rippleRGB = tex0.rgb * alphaRatio1 + tex1.rgb * alphaRatio2;
. vec4 buf = texture2D(Density, gl_FragCoord.xy * Scale );
. float d = 255.0*buf.x + buf.y;
. float w = intensity*d;
. gl_FragColor = vec4(rippleRGB/(1.0+w*ink_color), 1.0);
.}........precision mediump float;
.uniform sampler2D Velocity;
.uniform sampler2D Pressure;
.uniform vec2 InverseSize;
.//uniform sampler2D Boundary;
.uniform float GradientScale;
.vec2 encode(float v).{..const vec2 mask = vec2(0.00392157, 1.0);
..v = clamp(v, -127.0, 127.0);
..v += 127.0;
..vec2 p = fract(v*mask);
..p.x -= p.y/255.0;
..return p;
.}.float decode(vec2 v).{..return 1000.0*(dot(v, vec2(1.0, 0.00392157))-0.498039);
.}.void main().{. vec2 T = gl_FragCoord.xy*InverseSize;
. float pN = decode(texture2D(Pressure, T+vec2(0.0, InverseSize.y)).xy);
. float pS = decode(texture2D(Pressure, T+vec2(0.0,-InverseSize.y)).xy);
. float pE = decode(texture2D(Pressure, T+vec2( InverseSize.x, 0.0)).xy);
. float pW = decode(texture2D(Pressure, T+vec2(-InverseSize.x, 0.0)).xy);
. vec4 buf = texture2D(Velocity, T);
. vec2 oldV;
. oldV.x = 255.0*buf.x + buf.y - 127.0;
. oldV.y = 255.0*buf.z + buf.w - 127.0;
. vec2 grad = vec2(pE - pW, pN - pS) * GradientScale;
. vec2 newV = oldV - grad;
. gl_FragColor = vec4(encode(newV.x),encode(newV.y));
.}......uMESH_SIZE_WIDTH....uMESH_SIZE_HEIGHT...uNUM_DETAILS_WIDTH..uNUM_DETAILS_HEIGHT.uRefractiveIndex....aPosition...aHeights....uMVPMatrix..Scale...ink_color...alphaRatio1.alphaRatio2.intensity...Density.texture0....texture1....ink[native].after %s() glError (0x%x)...glGenTextures...glBindTexture...FRAMEBUFFER_ERROR - %d..current.previous....normal..len.Radius..VelocityGridInverseSize.Source..switches....ImpulseDensity..DensityGridInverseSize..mode....HalfInverseCellSize.Point...force...radius..GradientScale...InverseSize.Pressure....Alpha...InverseBeta.Divergence..TimeStep....Dissipation.BackwardStepSize....center..drag....SourceTexture.......uniform mat4 uMVPMatrix;
.attribute vec4 aPosition;
.varying vec2 vTexture0Coord;
.varying vec2 vTexture1Coord;
.uniform float uMESH_SIZE_WIDTH;
. uniform float uMESH_SIZE_HEIGHT;
. uniform float uNUM_DETAILS_WIDTH;
. uniform float uNUM_DETAILS_HEIGHT;
. void main() { . float maxX = uMESH_SIZE_WIDTH / 2.0;
. float maxY = uMESH_SIZE_HEIGHT / 2.0;
. vec4 pos = aPosition;
. vec3 v = vec3( pos.x, pos.y, 0.0 );
. vec3 d = vec3( v.x, v.y, 30.0 );
. float len = sqrt( dot( d, d ) );
. d = d / len;
. float r0, u0, v0, u1, v1;
. r0 = ( 30.9 - v.z ) / d.z;
. u0 = 0.25*( d.x * r0 + v.x ) / maxX + 0.5;
. v0 = -0.25*( d.y * r0 + v.y ) / maxY + 0.5;
. u1 = 0.5 + 0.25*pos.y / uMESH_SIZE_WIDTH;
. v1 = 0.5 + 0.25*pos.x / uMESH_SIZE_HEIGHT;
. vTexture0Coord = vec2( u1, v1 );
. vTexture1Coord = vec2( u0, v0 );
. gl_Position = uMVPMatrix*aPosition;
.}......precision mediump float;
.uniform sampler2D Source;
.uniform vec2 Scale;
.uniform vec2 VelocityGridInverseSize;
.uniform vec2 current;
.uniform vec2 previous;
.uniform vec2 normal;
.uniform float len;
.uniform float Radius;
.uniform int switches;
.vec2 encode(float v).{..const vec2 mask = vec2(0.00392157, 1.0);
..v = clamp(v, -127.0, 127.0);
..v += 127.0;
..vec2 p = fract(v*mask);
..p.x -= p.y/255.0;
..return p;
.}.void main().{. vec4 buf = texture2D(Source, gl_FragCoord.xy * VelocityGridInverseSize);
. vec2 u;
. float temp;
. if(switches==0) temp = 126.97;
else temp = 126.96;
. u.x = 255.0*buf.x + buf.y - temp;
. u.y = 255.0*buf.z + buf.w - temp;
. vec2 p = Scale*gl_FragCoord.xy;
. vec2 vector = p - previous;
. float dot_val = dot( normal, vector );
. if( dot_val > 0.0 && dot_val < len ). {. vec2 projected = previous + dot_val*normal;
. float d = distance(projected, p);
. vec2 vertical = p - projected;
. vec2 horizen = current - projected;
. . if( d < Radius ) u += (0.1*vertical + 0.1*horizen)*d;
. }. gl_FragColor.xy = encode(u.x);
. gl_FragColor.zw = encode(u.y);
.}..uniform mat4 uMVPMatrix;
.attribute vec4 aPosition;
.attribute vec4 aHeights;
.varying vec2 vTexture0Coord;
.varying vec2 vTexture1Coord;
.uniform float uMESH_SIZE_WIDTH;
. uniform float uMESH_SIZE_HEIGHT;
. uniform float uNUM_DETAILS_WIDTH;
. uniform float uNUM_DETAILS_HEIGHT;
. uniform float uRefractiveIndex;
. void main() { . float maxX = uMESH_SIZE_WIDTH / 2.0;
. float maxY = uMESH_SIZE_HEIGHT / 2.0;
. float rimo = uRefractiveIndex - 1.0;
. vec4 pos = aPosition;
. vec4 heights = aHeights;
. float len = heights.x;
. vec3 v = vec3( pos.x, pos.y, len * 0.25 );
. vec2 n = ( vec2( len ) - heights.yz ) * 0.25;
. float nz = sqrt(dot( n, n ) + 1.0 );
. n = n / nz;
. vec3 d = vec3( v.x, v.y, v.z + 30.0 );
. len = sqrt( dot( d, d ) );
. d = d / len;
. float t = dot( d, vec3( n.x, n.y, 1.0 ) ) * rimo;
. d.x += n.x * t;
. d.y += n.y * t;
. float r0, u0, v0;
. r0 = ( 30.9 - v.z ) / d.z;
. u0 = ( d.x * r0 + v.x ) / maxX * 0.25 + 0.5;
. v0 = ( d.y * r0 + v.y ) / maxY * -0.25 + 0.5;
. float uxx = n.x * 0.5 + 0.5 + pos.y / uMESH_SIZE_WIDTH * 0.25;
. float vxx = n.y * 0.5 + 0.5 + pos.x / uMESH_SIZE_HEIGHT * 0.25;
. vTexture0Coord = vec2( uxx, vxx );
. vTexture1Coord = vec2( u0, v0 );
. gl_Position = uMVPMatrix*aPosition;
.}.....precision mediump float;
.uniform sampler2D Pressure;
.uniform sampler2D Divergence;
.uniform float Alpha;
.uniform float InverseBeta;
.uniform vec2 InverseSize;
.vec2 encode(float v).{..const vec2 mask = vec2(1.0, 255.0);
. v *= 0.001;
..v += 0.498039;
..v = clamp(v, 0.0, 0.99999);
..vec2 p = fract(v*mask);
..p.x -= p.y/255.0;
..return p;
.}.float decode(vec2 v).{..return 1000.0*(dot(v, vec2(1.0, 0.00392157))-0.498039);
.}.void main().{. vec2 T = gl_FragCoord.xy*InverseSize;
. float pN = decode(texture2D(Pressure, T+vec2(0.0, InverseSize.y)).xy);
. float pS = decode(texture2D(Pressure, T+vec2(0.0,-InverseSize.y)).xy);
. float pE = decode(texture2D(Pressure, T+vec2( InverseSize.x, 0.0)).xy);
. float pW = decode(texture2D(Pressure, T+vec2(-InverseSize.x, 0.0)).xy);
. float pC = decode(texture2D(Pressure, T).xy);
. float bC = decode(texture2D(Divergence, T).xy);
. gl_FragColor.xy = encode((pW + pE + pS + pN + Alpha*bC)*InverseBeta);
.}........ink[native].Could not compile shader %d:.%s.....after %s() glError (0x%x)...glAttachShader..Could not link program:.%s..ink[native].AndroidBitmap_getInfo () failed! error = % d....AndroidBitmap_lockPixels () failed! error = % d