Skip to content

Commit 55f034a

Browse files
author
xufuji456
committed
Feature: change GLES2.0 to GLES3.0
1 parent 3be79a8 commit 55f034a

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

‎CameraFilter/src/main/java/com/frank/camerafilter/filter/advance/BeautySketchFilter.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.frank.camerafilter.filter.advance;
22

33
import android.content.Context;
4-
import android.opengl.GLES20;
4+
import android.opengl.GLES30;
55

66
import com.frank.camerafilter.R;
77
import 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

‎CameraFilter/src/main/res/raw/default_fragment.glsl‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,25 @@ varying mediump vec2 textureCoordinate;
77
uniform samplerExternalOES inputImageTexture;
88

99
void 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
}

0 commit comments

Comments
 (0)