Complete GL20 interface (#642)
This commit is contained in:
@@ -3,6 +3,7 @@ apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
dependencies {
|
||||
api project(':vtm')
|
||||
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
|
||||
}
|
||||
|
||||
android {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2019 Gustl22
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@@ -19,6 +20,8 @@ package org.oscim.gdx;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.opengl.GLES20;
|
||||
|
||||
import com.badlogic.gdx.backends.android.AndroidGL20;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
|
||||
import java.nio.Buffer;
|
||||
@@ -28,6 +31,8 @@ import java.nio.IntBuffer;
|
||||
@SuppressLint("NewApi")
|
||||
public class AndroidGL implements GL {
|
||||
|
||||
private static final AndroidGL20 androidGL = new AndroidGL20();
|
||||
|
||||
@Override
|
||||
public void attachShader(int program, int shader) {
|
||||
GLES20.glAttachShader(program, shader);
|
||||
@@ -103,11 +108,21 @@ public class AndroidGL implements GL {
|
||||
return GLES20.glCreateShader(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBuffer(int buffer) {
|
||||
androidGL.glDeleteBuffer(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteBuffers(int n, IntBuffer buffers) {
|
||||
GLES20.glDeleteBuffers(n, buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffer(int framebuffer) {
|
||||
androidGL.glDeleteFramebuffer(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
GLES20.glDeleteFramebuffers(n, framebuffers);
|
||||
@@ -118,6 +133,11 @@ public class AndroidGL implements GL {
|
||||
GLES20.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffer(int renderbuffer) {
|
||||
androidGL.glDeleteRenderbuffer(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
GLES20.glDeleteRenderbuffers(n, renderbuffers);
|
||||
@@ -160,6 +180,11 @@ public class AndroidGL implements GL {
|
||||
GLES20.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genBuffer() {
|
||||
return androidGL.glGenBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genBuffers(int n, IntBuffer buffers) {
|
||||
GLES20.glGenBuffers(n, buffers);
|
||||
@@ -170,11 +195,21 @@ public class AndroidGL implements GL {
|
||||
GLES20.glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genFramebuffer() {
|
||||
return androidGL.glGenFramebuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
GLES20.glGenFramebuffers(n, framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genRenderbuffer() {
|
||||
return androidGL.glGenRenderbuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
GLES20.glGenRenderbuffers(n, renderbuffers);
|
||||
@@ -187,14 +222,12 @@ public class AndroidGL implements GL {
|
||||
|
||||
@Override
|
||||
public String getActiveUniform(int program, int index, IntBuffer size, Buffer type) {
|
||||
//return GLES20.glGetActiveUniform(program, index, bufsize, length, size, type, name);
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
return androidGL.glGetActiveUniform(program, index, size, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
//GLES20.glGetAttachedShaders(program, maxcount, count, shaders);
|
||||
androidGL.glGetAttachedShaders(program, maxcount, count, shaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,8 +237,7 @@ public class AndroidGL implements GL {
|
||||
|
||||
@Override
|
||||
public void getBooleanv(int pname, Buffer params) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
//GLES20.glGetBooleanv(pname, params);
|
||||
androidGL.glGetBooleanv(pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,11 +292,6 @@ public class AndroidGL implements GL {
|
||||
GLES20.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getShaderSource(int shader, int bufsize, Buffer length, String source) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GLES20.glGetTexParameterfv(target, pname, params);
|
||||
@@ -308,8 +335,7 @@ public class AndroidGL implements GL {
|
||||
|
||||
@Override
|
||||
public void getVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
//GLES20.glGetVertexAttribPointerv(index, pname, pointer);
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
androidGL.glGetVertexAttribPointerv(index, pname, pointer);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -431,6 +457,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1fv(int location, int count, float[] v, int offset) {
|
||||
GLES20.glUniform1fv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1i(int location, int x) {
|
||||
GLES20.glUniform1i(location, x);
|
||||
@@ -443,6 +474,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform1iv(int location, int count, int[] v, int offset) {
|
||||
GLES20.glUniform1iv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2f(int location, float x, float y) {
|
||||
GLES20.glUniform2f(location, x, y);
|
||||
@@ -455,6 +491,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2fv(int location, int count, float[] v, int offset) {
|
||||
GLES20.glUniform2fv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2i(int location, int x, int y) {
|
||||
GLES20.glUniform2i(location, x, y);
|
||||
@@ -467,6 +508,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform2iv(int location, int count, int[] v, int offset) {
|
||||
GLES20.glUniform2iv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3f(int location, float x, float y, float z) {
|
||||
GLES20.glUniform3f(location, x, y, z);
|
||||
@@ -479,6 +525,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3fv(int location, int count, float[] v, int offset) {
|
||||
GLES20.glUniform3fv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3i(int location, int x, int y, int z) {
|
||||
GLES20.glUniform3i(location, x, y, z);
|
||||
@@ -491,6 +542,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform3iv(int location, int count, int[] v, int offset) {
|
||||
GLES20.glUniform3iv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4f(int location, float x, float y, float z, float w) {
|
||||
GLES20.glUniform4f(location, x, y, z, w);
|
||||
@@ -501,6 +557,11 @@ public class AndroidGL implements GL {
|
||||
GLES20.glUniform4fv(location, count, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4fv(int location, int count, float[] v, int offset) {
|
||||
GLES20.glUniform4fv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4i(int location, int x, int y, int z, int w) {
|
||||
GLES20.glUniform4i(location, x, y, z, w);
|
||||
@@ -513,24 +574,44 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniform4iv(int location, int count, int[] v, int offset) {
|
||||
GLES20.glUniform4iv(location, count, v, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GLES20.glUniformMatrix2fv(location, count, transpose, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, float[] value, int offset) {
|
||||
GLES20.glUniformMatrix2fv(location, count, transpose, value, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GLES20.glUniformMatrix3fv(location, count, transpose, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, float[] value, int offset) {
|
||||
GLES20.glUniformMatrix3fv(location, count, transpose, value, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GLES20.glUniformMatrix4fv(location, count, transpose, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, float[] value, int offset) {
|
||||
GLES20.glUniformMatrix4fv(location, count, transpose, value, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void useProgram(int program) {
|
||||
GLES20.glUseProgram(program);
|
||||
@@ -656,15 +737,13 @@ public class AndroidGL implements GL {
|
||||
@Override
|
||||
public void compressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border, int imageSize, Buffer data) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
|
||||
androidGL.glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void compressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format, int imageSize, Buffer data) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
|
||||
androidGL.glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -691,6 +770,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteTexture(int texture) {
|
||||
androidGL.glDeleteTexture(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void depthFunc(int func) {
|
||||
GLES20.glDepthFunc(func);
|
||||
@@ -757,6 +841,11 @@ public class AndroidGL implements GL {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int genTexture() {
|
||||
return androidGL.glGenTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getError() {
|
||||
return GLES20.glGetError();
|
||||
@@ -837,8 +926,7 @@ public class AndroidGL implements GL {
|
||||
@Override
|
||||
public void texSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type, Buffer pixels) {
|
||||
GLES20
|
||||
.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
|
||||
GLES20.glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user