File tree Expand file tree Collapse file tree
java/com/frank/camerafilter/filter/advance Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .frank .camerafilter .filter .advance ;
22
33import android .content .Context ;
4- import android .opengl .GLES20 ;
4+ import android .opengl .GLES30 ;
55
66import com .frank .camerafilter .R ;
77import com .frank .camerafilter .filter .BaseFilter ;
@@ -18,8 +18,8 @@ public BeautySketchFilter(Context context) {
1818
1919 protected void onInit () {
2020 super .onInit ();
21- strengthLocation = GLES20 .glGetUniformLocation (getProgramId (), "strength" );
22- stepOffsetLocation = GLES20 .glGetUniformLocation (getProgramId (), "singleStepOffset" );
21+ strengthLocation = GLES30 .glGetUniformLocation (getProgramId (), "strength" );
22+ stepOffsetLocation = GLES30 .glGetUniformLocation (getProgramId (), "singleStepOffset" );
2323 }
2424
2525 @ Override
Original file line number Diff line number Diff line change @@ -7,7 +7,25 @@ varying mediump vec2 textureCoordinate;
77uniform samplerExternalOES inputImageTexture;
88
99void main(){
10+ vec2 xy = textureCoordinate.xy;
11+ // two screen(0.25~0.75)
12+ // if (xy.x <= 0.5) {
13+ // xy.x += 0.25;
14+ // } else {
15+ // xy.x -= 0.25;
16+ // }
17+ // four screen
18+ // if (xy.x <= 0.5) {
19+ // xy.x = xy.x * 2.0;
20+ // } else {
21+ // xy.x = (xy.x - 0.5) * 2.0;
22+ // }
23+ // if (xy.y <= 0.5) {
24+ // xy.y = xy.y * 2.0;
25+ // } else {
26+ // xy.y = (xy.y - 0.5) * 2.0;
27+ // }
1028
11- vec3 centralColor = texture2D (inputImageTexture, textureCoordinate ).rgb;
29+ vec3 centralColor = texture2D (inputImageTexture, xy ).rgb;
1230 gl_FragColor = vec4 (centralColor.rgb,1.0 );
1331}
You can’t perform that action at this time.
0 commit comments