what-the-bank/sources/o/iPJ.java

119 lines
4.6 KiB
Java

package o;
import android.opengl.GLES20;
import android.opengl.Matrix;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
/* loaded from: classes.dex */
public final class iPJ {
public static final float[] c;
public static final float[] e;
int a;
int b;
public int d;
int f;
int g;
private int i;
int j;
static {
float[] fArr = new float[16];
c = fArr;
Matrix.setIdentityM(fArr, 0);
float[] fArr2 = new float[16];
e = fArr2;
Matrix.setIdentityM(fArr2, 0);
Matrix.translateM(fArr2, 0, BitmapDescriptorFactory.HUE_RED, 1.0f, BitmapDescriptorFactory.HUE_RED);
Matrix.scaleM(fArr2, 0, 1.0f, -1.0f, 1.0f);
}
public iPJ(int i) {
this.i = i;
if (i == 0) {
this.d = 3553;
this.b = b("uniform mat4 uMVPMatrix;\nuniform mat4 uTexMatrix;\nattribute vec4 aPosition;\nattribute vec4 aTextureCoord;\nvarying vec2 vTextureCoord;\nvoid main() {\n gl_Position = uMVPMatrix * aPosition;\n vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n}\n", "precision mediump float;\nvarying vec2 vTextureCoord;\nuniform sampler2D sTexture;\nvoid main() {\n gl_FragColor = texture2D(sTexture, vTextureCoord);\n}\n");
} else if (i == 1) {
this.d = 36197;
this.b = b("uniform mat4 uMVPMatrix;\nuniform mat4 uTexMatrix;\nattribute vec4 aPosition;\nattribute vec4 aTextureCoord;\nvarying vec2 vTextureCoord;\nvoid main() {\n gl_Position = uMVPMatrix * aPosition;\n vTextureCoord = (uTexMatrix * aTextureCoord).xy;\n}\n", "#extension GL_OES_EGL_image_external : require\nprecision mediump float;\nvarying vec2 vTextureCoord;\nuniform samplerExternalOES sTexture;\nvoid main() {\n gl_FragColor = texture2D(sTexture, vTextureCoord);\n}\n");
} else {
throw new RuntimeException("Unhandled type ".concat(String.valueOf(i)));
}
int i2 = this.b;
if (i2 == 0) {
throw new RuntimeException("Unable to create program");
}
int glGetAttribLocation = GLES20.glGetAttribLocation(i2, "aPosition");
this.a = glGetAttribLocation;
c(glGetAttribLocation, "aPosition");
int glGetAttribLocation2 = GLES20.glGetAttribLocation(this.b, "aTextureCoord");
this.g = glGetAttribLocation2;
c(glGetAttribLocation2, "aTextureCoord");
int glGetUniformLocation = GLES20.glGetUniformLocation(this.b, "uMVPMatrix");
this.f = glGetUniformLocation;
c(glGetUniformLocation, "uMVPMatrix");
int glGetUniformLocation2 = GLES20.glGetUniformLocation(this.b, "uTexMatrix");
this.j = glGetUniformLocation2;
c(glGetUniformLocation2, "uTexMatrix");
}
private static int b(String str, String str2) {
int a;
int a2 = a(35633, str);
if (a2 == 0 || (a = a(35632, str2)) == 0) {
return 0;
}
int glCreateProgram = GLES20.glCreateProgram();
e("glCreateProgram");
GLES20.glAttachShader(glCreateProgram, a2);
e("glAttachShader");
GLES20.glAttachShader(glCreateProgram, a);
e("glAttachShader");
GLES20.glLinkProgram(glCreateProgram);
int[] iArr = new int[1];
GLES20.glGetProgramiv(glCreateProgram, 35714, iArr, 0);
if (iArr[0] == 1) {
return glCreateProgram;
}
GLES20.glGetProgramInfoLog(glCreateProgram);
GLES20.glDeleteProgram(glCreateProgram);
return 0;
}
private static int a(int i, String str) {
int glCreateShader = GLES20.glCreateShader(i);
e("glCreateShader type=".concat(String.valueOf(i)));
GLES20.glShaderSource(glCreateShader, str);
GLES20.glCompileShader(glCreateShader);
int[] iArr = new int[1];
GLES20.glGetShaderiv(glCreateShader, 35713, iArr, 0);
if (iArr[0] != 0) {
return glCreateShader;
}
GLES20.glGetShaderInfoLog(glCreateShader);
GLES20.glDeleteShader(glCreateShader);
return 0;
}
private static void c(int i, String str) {
if (i >= 0) {
return;
}
StringBuilder sb = new StringBuilder("Unable to locate '");
sb.append(str);
sb.append("' in program");
throw new RuntimeException(sb.toString());
}
public static void e(String str) {
int glGetError = GLES20.glGetError();
if (glGetError == 0) {
return;
}
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.append(": glError 0x");
sb.append(Integer.toHexString(glGetError));
throw new RuntimeException(sb.toString());
}
}