mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-28 01:52:26 -06:00
53 lines
1.7 KiB
Java
53 lines
1.7 KiB
Java
package org.webrtc;
|
|
|
|
import android.opengl.GLES20;
|
|
import android.opengl.GLException;
|
|
import androidx.work.Data;
|
|
import java.nio.ByteBuffer;
|
|
import java.nio.ByteOrder;
|
|
import java.nio.FloatBuffer;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class GlUtil {
|
|
private GlUtil() {
|
|
}
|
|
|
|
/* loaded from: classes3.dex */
|
|
public static class GlOutOfMemoryException extends GLException {
|
|
public GlOutOfMemoryException(int i, String str) {
|
|
super(i, str);
|
|
}
|
|
}
|
|
|
|
public static void checkNoGLES2Error(String str) {
|
|
int glGetError = GLES20.glGetError();
|
|
if (glGetError != 0) {
|
|
if (glGetError == 1285) {
|
|
throw new GlOutOfMemoryException(glGetError, str);
|
|
}
|
|
throw new GLException(glGetError, str + ": GLES20 error: " + glGetError);
|
|
}
|
|
}
|
|
|
|
public static FloatBuffer createFloatBuffer(float[] fArr) {
|
|
ByteBuffer allocateDirect = ByteBuffer.allocateDirect(fArr.length * 4);
|
|
allocateDirect.order(ByteOrder.nativeOrder());
|
|
FloatBuffer asFloatBuffer = allocateDirect.asFloatBuffer();
|
|
asFloatBuffer.put(fArr);
|
|
asFloatBuffer.position(0);
|
|
return asFloatBuffer;
|
|
}
|
|
|
|
public static int generateTexture(int i) {
|
|
int[] iArr = new int[1];
|
|
GLES20.glGenTextures(1, iArr, 0);
|
|
int i2 = iArr[0];
|
|
GLES20.glBindTexture(i, i2);
|
|
GLES20.glTexParameterf(i, 10241, 9729.0f);
|
|
GLES20.glTexParameterf(i, Data.MAX_DATA_BYTES, 9729.0f);
|
|
GLES20.glTexParameterf(i, 10242, 33071.0f);
|
|
GLES20.glTexParameterf(i, 10243, 33071.0f);
|
|
checkNoGLES2Error("generateTexture");
|
|
return i2;
|
|
}
|
|
}
|