what-the-bank/sources/com/kofax/kmc/ken/engines/gpu/OpenGlUtils.java

56 lines
1.9 KiB
Java

package com.kofax.kmc.ken.engines.gpu;
import android.opengl.GLES20;
import com.kofax.mobile.sdk._internal.k;
/* loaded from: classes3.dex */
public class OpenGlUtils {
public static final int NO_TEXTURE = -1;
public static int loadShader(String str, int i) {
int[] iArr = new int[1];
int glCreateShader = GLES20.glCreateShader(i);
GLES20.glShaderSource(glCreateShader, str);
GLES20.glCompileShader(glCreateShader);
GLES20.glGetShaderiv(glCreateShader, 35713, iArr, 0);
if (iArr[0] != 0) {
return glCreateShader;
}
StringBuilder sb = new StringBuilder("Compilation\n");
sb.append(GLES20.glGetShaderInfoLog(glCreateShader));
k.C(sb.toString());
return 0;
}
public static int loadProgram(String str, String str2, int[] iArr, String[] strArr, int i) {
int[] iArr2 = new int[1];
int loadShader = loadShader(str, 35633);
if (loadShader == 0) {
k.E("Vertex Shader Failed");
k.E(str);
return 0;
}
int loadShader2 = loadShader(str2, 35632);
if (loadShader2 == 0) {
k.E("Fragment Shader Failed");
k.E("strFSource");
return 0;
}
int glCreateProgram = GLES20.glCreateProgram();
GLES20.glAttachShader(glCreateProgram, loadShader);
GLES20.glAttachShader(glCreateProgram, loadShader2);
for (int i2 = 0; i2 < i; i2++) {
GLES20.glBindAttribLocation(glCreateProgram, iArr[i2], strArr[i2]);
}
GLES20.glLinkProgram(glCreateProgram);
GLES20.glGetProgramiv(glCreateProgram, 35714, iArr2, 0);
if (iArr2[0] <= 0) {
k.C("Linking Failed");
return 0;
}
GLES20.glDeleteShader(loadShader);
GLES20.glDeleteShader(loadShader2);
return glCreateProgram;
}
}