Complete GL20 interface (#642)

This commit is contained in:
Gustl22
2019-01-26 21:07:09 +01:00
committed by Emux
parent 1af38a7306
commit ce87e89b4f
8 changed files with 496 additions and 53 deletions

View File

@@ -1,5 +1,20 @@
package org.oscim.gdx.client;
/*
* Copyright 2014 Hannes Janetzek
* Copyright 2019 Gustl22
*
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
*
* This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
* <p/>
@@ -16,6 +31,8 @@ package org.oscim.gdx.client;
* limitations under the License.
******************************************************************************/
package org.oscim.gdx.client;
import com.badlogic.gdx.backends.gwt.GwtGL20;
import com.badlogic.gdx.graphics.Pixmap;
import com.google.gwt.typedarrays.client.Uint8ArrayNative;
@@ -37,15 +54,10 @@ public class GdxGL extends GwtGL20 implements GL {
this.gl = gl;
}
// @Override
// public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) {
//
// }
@Override
public void glTexImage2D(int target, int level, int internalformat, int width, int height,
int border, int format, int type, Buffer pixels) {
/*glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);*/
if (pixels == null) {
gl.texImage2D(target, level, internalformat,
width, height, border, format,
@@ -165,6 +177,11 @@ public class GdxGL extends GwtGL20 implements GL {
glDeleteTextures(n, textures);
}
@Override
public void deleteTexture(int texture) {
glDeleteTexture(texture);
}
@Override
public void depthFunc(int func) {
glDepthFunc(func);
@@ -220,6 +237,11 @@ public class GdxGL extends GwtGL20 implements GL {
glGenTextures(n, textures);
}
@Override
public int genTexture() {
return glGenTexture();
}
@Override
public int getError() {
return glGetError();
@@ -356,6 +378,11 @@ public class GdxGL extends GwtGL20 implements GL {
glDeleteBuffers(n, buffers);
}
@Override
public void deleteFramebuffer(int framebuffer) {
glDeleteFramebuffer(framebuffer);
}
@Override
public void getBufferParameteriv(int target, int pname, IntBuffer params) {
glGetBufferParameteriv(target, pname, params);
@@ -461,6 +488,11 @@ public class GdxGL extends GwtGL20 implements GL {
return glCreateShader(type);
}
@Override
public void deleteBuffer(int buffer) {
glDeleteBuffer(buffer);
}
@Override
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
glDeleteFramebuffers(n, framebuffers);
@@ -471,6 +503,11 @@ public class GdxGL extends GwtGL20 implements GL {
glDeleteProgram(program);
}
@Override
public void deleteRenderbuffer(int renderbuffer) {
glDeleteRenderbuffer(renderbuffer);
}
@Override
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
glDeleteRenderbuffers(n, renderbuffers);
@@ -508,16 +545,31 @@ public class GdxGL extends GwtGL20 implements GL {
glFramebufferTexture2D(target, attachment, textarget, texture, level);
}
@Override
public int genBuffer() {
return glGenBuffer();
}
@Override
public void generateMipmap(int target) {
glGenerateMipmap(target);
}
@Override
public int genFramebuffer() {
return glGenFramebuffer();
}
@Override
public void genFramebuffers(int n, IntBuffer framebuffers) {
glGenFramebuffers(n, framebuffers);
}
@Override
public int genRenderbuffer() {
return glGenRenderbuffer();
}
@Override
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
glGenRenderbuffers(n, renderbuffers);
@@ -600,11 +652,6 @@ public class GdxGL extends GwtGL20 implements GL {
precision);
}
@Override
public void getShaderSource(int shader, int bufsize, Buffer length, String source) {
throw new UnsupportedOperationException("Not implemented");
}
@Override
public void getUniformfv(int program, int location, FloatBuffer params) {
glGetUniformfv(program, location, params);
@@ -714,6 +761,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform1fv(location, count, v);
}
@Override
public void uniform1fv(int location, int count, float[] v, int offset) {
glUniform1fv(location, count, v, offset);
}
@Override
public void uniform1i(int location, int x) {
glUniform1i(location, x);
@@ -724,6 +776,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform1iv(location, count, v);
}
@Override
public void uniform1iv(int location, int count, int[] v, int offset) {
glUniform1iv(location, count, v, offset);
}
@Override
public void uniform2f(int location, float x, float y) {
glUniform2f(location, x, y);
@@ -734,6 +791,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform2fv(location, count, v);
}
@Override
public void uniform2fv(int location, int count, float[] v, int offset) {
glUniform2fv(location, count, v, offset);
}
@Override
public void uniform2i(int location, int x, int y) {
glUniform2i(location, x, y);
@@ -744,6 +806,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform2iv(location, count, v);
}
@Override
public void uniform2iv(int location, int count, int[] v, int offset) {
glUniform2iv(location, count, v, offset);
}
@Override
public void uniform3f(int location, float x, float y, float z) {
glUniform3f(location, x, y, z);
@@ -754,6 +821,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform3fv(location, count, v);
}
@Override
public void uniform3fv(int location, int count, float[] v, int offset) {
glUniform3fv(location, count, v, offset);
}
@Override
public void uniform3i(int location, int x, int y, int z) {
glUniform3i(location, x, y, z);
@@ -764,6 +836,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform3iv(location, count, v);
}
@Override
public void uniform3iv(int location, int count, int[] v, int offset) {
glUniform3iv(location, count, v, offset);
}
@Override
public void uniform4f(int location, float x, float y, float z, float w) {
glUniform4f(location, x, y, z, w);
@@ -774,6 +851,11 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform4fv(location, count, v);
}
@Override
public void uniform4fv(int location, int count, float[] v, int offset) {
glUniform4fv(location, count, v, offset);
}
@Override
public void uniform4i(int location, int x, int y, int z, int w) {
glUniform4i(location, x, y, z, w);
@@ -784,21 +866,41 @@ public class GdxGL extends GwtGL20 implements GL {
glUniform4iv(location, count, v);
}
@Override
public void uniform4iv(int location, int count, int[] v, int offset) {
glUniform4iv(location, count, v, offset);
}
@Override
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
glUniformMatrix2fv(location, count, transpose, value);
}
@Override
public void uniformMatrix2fv(int location, int count, boolean transpose, float[] value, int offset) {
glUniformMatrix2fv(location, count, transpose, value, offset);
}
@Override
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
glUniformMatrix3fv(location, count, transpose, value);
}
@Override
public void uniformMatrix3fv(int location, int count, boolean transpose, float[] value, int offset) {
glUniformMatrix3fv(location, count, transpose, value, offset);
}
@Override
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
glUniformMatrix4fv(location, count, transpose, value);
}
@Override
public void uniformMatrix4fv(int location, int count, boolean transpose, float[] value, int offset) {
glUniformMatrix4fv(location, count, transpose, value, offset);
}
@Override
public void useProgram(int program) {
glUseProgram(program);