nicer gl api
- java class name should suffice as namespace - also use import static gl instance seems to work now with Gwt
This commit is contained in:
parent
b2008aa086
commit
846d90f9fe
@ -75,10 +75,10 @@ public class AndroidBitmap implements org.oscim.backend.canvas.Bitmap {
|
||||
int type = GLUtils.getType(mBitmap);
|
||||
|
||||
if (replace)
|
||||
GLUtils.texSubImage2D(GL20.GL_TEXTURE_2D, 0, 0, 0, mBitmap, format,
|
||||
GLUtils.texSubImage2D(GL20.TEXTURE_2D, 0, 0, 0, mBitmap, format,
|
||||
type);
|
||||
else
|
||||
GLUtils.texImage2D(GL20.GL_TEXTURE_2D, 0, format, mBitmap, type, 0);
|
||||
GLUtils.texImage2D(GL20.TEXTURE_2D, 0, format, mBitmap, type, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,585 +20,585 @@ import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.opengl.GLES20;
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public class AndroidGL implements GL20 {
|
||||
public class AndroidGL implements GL {
|
||||
|
||||
@Override
|
||||
public void glAttachShader(int program, int shader) {
|
||||
public void attachShader(int program, int shader) {
|
||||
GLES20.glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindAttribLocation(int program, int index, String name) {
|
||||
public void bindAttribLocation(int program, int index, String name) {
|
||||
GLES20.glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindBuffer(int target, int buffer) {
|
||||
public void bindBuffer(int target, int buffer) {
|
||||
GLES20.glBindBuffer(target, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindFramebuffer(int target, int framebuffer) {
|
||||
public void bindFramebuffer(int target, int framebuffer) {
|
||||
GLES20.glBindFramebuffer(target, framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindRenderbuffer(int target, int renderbuffer) {
|
||||
public void bindRenderbuffer(int target, int renderbuffer) {
|
||||
GLES20.glBindRenderbuffer(target, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBlendColor(float red, float green, float blue, float alpha) {
|
||||
public void blendColor(float red, float green, float blue, float alpha) {
|
||||
GLES20.glBlendColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBlendEquation(int mode) {
|
||||
public void blendEquation(int mode) {
|
||||
GLES20.glBlendEquation(mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBlendEquationSeparate(int modeRGB, int modeAlpha) {
|
||||
public void blendEquationSeparate(int modeRGB, int modeAlpha) {
|
||||
GLES20.glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
public void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
GLES20.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBufferData(int target, int size, Buffer data, int usage) {
|
||||
public void bufferData(int target, int size, Buffer data, int usage) {
|
||||
GLES20.glBufferData(target, size, data, usage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBufferSubData(int target, int offset, int size, Buffer data) {
|
||||
public void bufferSubData(int target, int offset, int size, Buffer data) {
|
||||
GLES20.glBufferSubData(target, offset, size, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glCheckFramebufferStatus(int target) {
|
||||
public int checkFramebufferStatus(int target) {
|
||||
return GLES20.glCheckFramebufferStatus(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCompileShader(int shader) {
|
||||
public void compileShader(int shader) {
|
||||
GLES20.glCompileShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glCreateProgram() {
|
||||
public int createProgram() {
|
||||
return GLES20.glCreateProgram();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glCreateShader(int type) {
|
||||
public int createShader(int type) {
|
||||
return GLES20.glCreateShader(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteBuffers(int n, IntBuffer buffers) {
|
||||
public void deleteBuffers(int n, IntBuffer buffers) {
|
||||
GLES20.glDeleteBuffers(n, buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
GLES20.glDeleteFramebuffers(n, framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteProgram(int program) {
|
||||
public void deleteProgram(int program) {
|
||||
GLES20.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
GLES20.glDeleteRenderbuffers(n, renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteShader(int shader) {
|
||||
public void deleteShader(int shader) {
|
||||
GLES20.glDeleteShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDetachShader(int program, int shader) {
|
||||
public void detachShader(int program, int shader) {
|
||||
GLES20.glDetachShader(program, shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDisableVertexAttribArray(int index) {
|
||||
public void disableVertexAttribArray(int index) {
|
||||
GLES20.glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawElements(int mode, int count, int type, int offset) {
|
||||
public void drawElements(int mode, int count, int type, int offset) {
|
||||
GLES20.glDrawElements(mode, count, type, offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glEnableVertexAttribArray(int index) {
|
||||
public void enableVertexAttribArray(int index) {
|
||||
GLES20.glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer) {
|
||||
GLES20.glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level) {
|
||||
GLES20.glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGenBuffers(int n, IntBuffer buffers) {
|
||||
public void genBuffers(int n, IntBuffer buffers) {
|
||||
GLES20.glGenBuffers(n, buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGenerateMipmap(int target) {
|
||||
public void generateMipmap(int target) {
|
||||
GLES20.glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGenFramebuffers(int n, IntBuffer framebuffers) {
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
GLES20.glGenFramebuffers(n, framebuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGenRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
GLES20.glGenRenderbuffers(n, renderbuffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String glGetActiveAttrib(int program, int index, IntBuffer size, Buffer type) {
|
||||
public String getActiveAttrib(int program, int index, IntBuffer size, Buffer type) {
|
||||
return GLES20.glGetActiveAttrib(program, index, size, (IntBuffer) type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type) {
|
||||
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");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
public void getAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
//GLES20.glGetAttachedShaders(program, maxcount, count, shaders);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glGetAttribLocation(int program, String name) {
|
||||
public int getAttribLocation(int program, String name) {
|
||||
return GLES20.glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetBooleanv(int pname, Buffer params) {
|
||||
public void getBooleanv(int pname, Buffer params) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
//GLES20.glGetBooleanv(pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetBufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
public void getBufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
GLES20.glGetBufferParameteriv(target, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetFloatv(int pname, FloatBuffer params) {
|
||||
public void getFloatv(int pname, FloatBuffer params) {
|
||||
GLES20.glGetFloatv(pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
public void getFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params) {
|
||||
GLES20.glGetFramebufferAttachmentParameteriv(target, attachment, pname, params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetProgramiv(int program, int pname, IntBuffer params) {
|
||||
public void getProgramiv(int program, int pname, IntBuffer params) {
|
||||
GLES20.glGetProgramiv(program, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String glGetProgramInfoLog(int program) {
|
||||
public String getProgramInfoLog(int program) {
|
||||
return GLES20.glGetProgramInfoLog(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
GLES20.glGetRenderbufferParameteriv(target, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetShaderiv(int shader, int pname, IntBuffer params) {
|
||||
public void getShaderiv(int shader, int pname, IntBuffer params) {
|
||||
GLES20.glGetShaderiv(shader, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String glGetShaderInfoLog(int shader) {
|
||||
public String getShaderInfoLog(int shader) {
|
||||
return GLES20.glGetShaderInfoLog(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
public void getShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision) {
|
||||
GLES20.glGetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetShaderSource(int shader, int bufsize, Buffer length, String source) {
|
||||
public void getShaderSource(int shader, int bufsize, Buffer length, String source) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
public void getTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GLES20.glGetTexParameterfv(target, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
public void getTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
GLES20.glGetTexParameteriv(target, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetUniformfv(int program, int location, FloatBuffer params) {
|
||||
public void getUniformfv(int program, int location, FloatBuffer params) {
|
||||
GLES20.glGetUniformfv(program, location, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetUniformiv(int program, int location, IntBuffer params) {
|
||||
public void getUniformiv(int program, int location, IntBuffer params) {
|
||||
GLES20.glGetUniformiv(program, location, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glGetUniformLocation(int program, String name) {
|
||||
public int getUniformLocation(int program, String name) {
|
||||
return GLES20.glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetVertexAttribfv(int index, int pname, FloatBuffer params) {
|
||||
public void getVertexAttribfv(int index, int pname, FloatBuffer params) {
|
||||
GLES20.glGetVertexAttribfv(index, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetVertexAttribiv(int index, int pname, IntBuffer params) {
|
||||
public void getVertexAttribiv(int index, int pname, IntBuffer params) {
|
||||
GLES20.glGetVertexAttribiv(index, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
public void getVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
//GLES20.glGetVertexAttribPointerv(index, pname, pointer);
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsBuffer(int buffer) {
|
||||
public boolean isBuffer(int buffer) {
|
||||
return GLES20.glIsBuffer(buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsEnabled(int cap) {
|
||||
public boolean isEnabled(int cap) {
|
||||
return GLES20.glIsEnabled(cap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsFramebuffer(int framebuffer) {
|
||||
public boolean isFramebuffer(int framebuffer) {
|
||||
return GLES20.glIsFramebuffer(framebuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsProgram(int program) {
|
||||
public boolean isProgram(int program) {
|
||||
return GLES20.glIsProgram(program);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsRenderbuffer(int renderbuffer) {
|
||||
public boolean isRenderbuffer(int renderbuffer) {
|
||||
return GLES20.glIsRenderbuffer(renderbuffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsShader(int shader) {
|
||||
public boolean isShader(int shader) {
|
||||
return GLES20.glIsShader(shader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean glIsTexture(int texture) {
|
||||
public boolean isTexture(int texture) {
|
||||
return GLES20.glIsTexture(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glLinkProgram(int program) {
|
||||
public void linkProgram(int program) {
|
||||
GLES20.glLinkProgram(program);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glReleaseShaderCompiler() {
|
||||
public void releaseShaderCompiler() {
|
||||
GLES20.glReleaseShaderCompiler();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glRenderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
GLES20.glRenderbufferStorage(target, internalformat, width, height);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glSampleCoverage(float value, boolean invert) {
|
||||
public void sampleCoverage(float value, boolean invert) {
|
||||
GLES20.glSampleCoverage(value, invert);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
public void shaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
GLES20.glShaderBinary(n, shaders, binaryformat, binary, length);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glShaderSource(int shader, String string) {
|
||||
public void shaderSource(int shader, String string) {
|
||||
GLES20.glShaderSource(shader, string);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glStencilFuncSeparate(int face, int func, int ref, int mask) {
|
||||
public void stencilFuncSeparate(int face, int func, int ref, int mask) {
|
||||
GLES20.glStencilFuncSeparate(face, func, ref, mask);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glStencilMaskSeparate(int face, int mask) {
|
||||
public void stencilMaskSeparate(int face, int mask) {
|
||||
GLES20.glStencilMaskSeparate(face, mask);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glStencilOpSeparate(int face, int fail, int zfail, int zpass) {
|
||||
public void stencilOpSeparate(int face, int fail, int zfail, int zpass) {
|
||||
GLES20.glStencilOpSeparate(face, fail, zfail, zpass);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
public void texParameterfv(int target, int pname, FloatBuffer params) {
|
||||
GLES20.glTexParameterfv(target, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glTexParameteri(int target, int pname, int param) {
|
||||
public void texParameteri(int target, int pname, int param) {
|
||||
GLES20.glTexParameteri(target, pname, param);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
public void texParameteriv(int target, int pname, IntBuffer params) {
|
||||
GLES20.glTexParameteriv(target, pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform1f(int location, float x) {
|
||||
public void uniform1f(int location, float x) {
|
||||
GLES20.glUniform1f(location, x);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform1fv(int location, int count, FloatBuffer v) {
|
||||
public void uniform1fv(int location, int count, FloatBuffer v) {
|
||||
GLES20.glUniform1fv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform1i(int location, int x) {
|
||||
public void uniform1i(int location, int x) {
|
||||
GLES20.glUniform1i(location, x);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform1iv(int location, int count, IntBuffer v) {
|
||||
public void uniform1iv(int location, int count, IntBuffer v) {
|
||||
GLES20.glUniform1iv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform2f(int location, float x, float y) {
|
||||
public void uniform2f(int location, float x, float y) {
|
||||
GLES20.glUniform2f(location, x, y);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform2fv(int location, int count, FloatBuffer v) {
|
||||
public void uniform2fv(int location, int count, FloatBuffer v) {
|
||||
GLES20.glUniform2fv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform2i(int location, int x, int y) {
|
||||
public void uniform2i(int location, int x, int y) {
|
||||
GLES20.glUniform2i(location, x, y);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform2iv(int location, int count, IntBuffer v) {
|
||||
public void uniform2iv(int location, int count, IntBuffer v) {
|
||||
GLES20.glUniform2iv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform3f(int location, float x, float y, float z) {
|
||||
public void uniform3f(int location, float x, float y, float z) {
|
||||
GLES20.glUniform3f(location, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform3fv(int location, int count, FloatBuffer v) {
|
||||
public void uniform3fv(int location, int count, FloatBuffer v) {
|
||||
GLES20.glUniform3fv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform3i(int location, int x, int y, int z) {
|
||||
public void uniform3i(int location, int x, int y, int z) {
|
||||
GLES20.glUniform3i(location, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform3iv(int location, int count, IntBuffer v) {
|
||||
public void uniform3iv(int location, int count, IntBuffer v) {
|
||||
GLES20.glUniform3iv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform4f(int location, float x, float y, float z, float w) {
|
||||
public void uniform4f(int location, float x, float y, float z, float w) {
|
||||
GLES20.glUniform4f(location, x, y, z, w);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform4fv(int location, int count, FloatBuffer v) {
|
||||
public void uniform4fv(int location, int count, FloatBuffer v) {
|
||||
GLES20.glUniform4fv(location, count, v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform4i(int location, int x, int y, int z, int w) {
|
||||
public void uniform4i(int location, int x, int y, int z, int w) {
|
||||
GLES20.glUniform4i(location, x, y, z, w);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniform4iv(int location, int count, IntBuffer v) {
|
||||
public void uniform4iv(int location, int count, IntBuffer v) {
|
||||
GLES20.glUniform4iv(location, count, v);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GLES20.glUniformMatrix2fv(location, count, transpose, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GLES20.glUniformMatrix3fv(location, count, transpose, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
GLES20.glUniformMatrix4fv(location, count, transpose, value);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glUseProgram(int program) {
|
||||
public void useProgram(int program) {
|
||||
GLES20.glUseProgram(program);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glValidateProgram(int program) {
|
||||
public void validateProgram(int program) {
|
||||
GLES20.glValidateProgram(program);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib1f(int indx, float x) {
|
||||
public void vertexAttrib1f(int indx, float x) {
|
||||
GLES20.glVertexAttrib1f(indx, x);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib1fv(int indx, FloatBuffer values) {
|
||||
public void vertexAttrib1fv(int indx, FloatBuffer values) {
|
||||
GLES20.glVertexAttrib1fv(indx, values);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib2f(int indx, float x, float y) {
|
||||
public void vertexAttrib2f(int indx, float x, float y) {
|
||||
GLES20.glVertexAttrib2f(indx, x, y);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib2fv(int indx, FloatBuffer values) {
|
||||
public void vertexAttrib2fv(int indx, FloatBuffer values) {
|
||||
GLES20.glVertexAttrib2fv(indx, values);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib3f(int indx, float x, float y, float z) {
|
||||
public void vertexAttrib3f(int indx, float x, float y, float z) {
|
||||
GLES20.glVertexAttrib3f(indx, x, y, z);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib3fv(int indx, FloatBuffer values) {
|
||||
public void vertexAttrib3fv(int indx, FloatBuffer values) {
|
||||
GLES20.glVertexAttrib3fv(indx, values);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib4f(int indx, float x, float y, float z, float w) {
|
||||
public void vertexAttrib4f(int indx, float x, float y, float z, float w) {
|
||||
GLES20.glVertexAttrib4f(indx, x, y, z, w);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttrib4fv(int indx, FloatBuffer values) {
|
||||
public void vertexAttrib4fv(int indx, FloatBuffer values) {
|
||||
GLES20.glVertexAttrib4fv(indx, values);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer ptr) {
|
||||
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int offset) {
|
||||
// FIXME check implementation!
|
||||
GLES20.glVertexAttribPointer(indx, size, type, normalized, stride, offset);
|
||||
@ -606,243 +606,244 @@ public class AndroidGL implements GL20 {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glActiveTexture(int texture) {
|
||||
public void activeTexture(int texture) {
|
||||
GLES20.glActiveTexture(texture);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBindTexture(int target, int texture) {
|
||||
public void bindTexture(int target, int texture) {
|
||||
GLES20.glBindTexture(target, texture);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glBlendFunc(int sfactor, int dfactor) {
|
||||
public void blendFunc(int sfactor, int dfactor) {
|
||||
GLES20.glBlendFunc(sfactor, dfactor);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glClear(int mask) {
|
||||
public void clear(int mask) {
|
||||
GLES20.glClear(mask);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glClearColor(float red, float green, float blue, float alpha) {
|
||||
public void clearColor(float red, float green, float blue, float alpha) {
|
||||
GLES20.glClearColor(red, green, blue, alpha);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glClearDepthf(float depth) {
|
||||
public void clearDepthf(float depth) {
|
||||
GLES20.glClearDepthf(depth);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glClearStencil(int s) {
|
||||
public void clearStencil(int s) {
|
||||
GLES20.glClearStencil(s);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
public void colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
GLES20.glColorMask(red, green, blue, alpha);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCompressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
public void compressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border, int imageSize, Buffer data) {
|
||||
throw new UnsupportedOperationException("missing implementation");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
public void copyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border) {
|
||||
GLES20.glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
public void copyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height) {
|
||||
GLES20.glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glCullFace(int mode) {
|
||||
public void cullFace(int mode) {
|
||||
GLES20.glCullFace(mode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDeleteTextures(int n, IntBuffer textures) {
|
||||
public void deleteTextures(int n, IntBuffer textures) {
|
||||
GLES20.glDeleteTextures(n, textures);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDepthFunc(int func) {
|
||||
public void depthFunc(int func) {
|
||||
GLES20.glDepthFunc(func);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDepthMask(boolean flag) {
|
||||
public void depthMask(boolean flag) {
|
||||
GLES20.glDepthMask(flag);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDepthRangef(float zNear, float zFar) {
|
||||
public void depthRangef(float zNear, float zFar) {
|
||||
GLES20.glDepthRangef(zNear, zFar);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDisable(int cap) {
|
||||
public void disable(int cap) {
|
||||
GLES20.glDisable(cap);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawArrays(int mode, int first, int count) {
|
||||
public void drawArrays(int mode, int first, int count) {
|
||||
GLES20.glDrawArrays(mode, first, count);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glDrawElements(int mode, int count, int type, Buffer indices) {
|
||||
public void drawElements(int mode, int count, int type, Buffer indices) {
|
||||
GLES20.glDrawElements(mode, count, type, indices);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glEnable(int cap) {
|
||||
public void enable(int cap) {
|
||||
GLES20.glEnable(cap);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFinish() {
|
||||
public void finish() {
|
||||
GLES20.glFinish();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFlush() {
|
||||
public void flush() {
|
||||
GLES20.glFlush();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glFrontFace(int mode) {
|
||||
public void frontFace(int mode) {
|
||||
GLES20.glFrontFace(mode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGenTextures(int n, IntBuffer textures) {
|
||||
public void genTextures(int n, IntBuffer textures) {
|
||||
GLES20.glGenTextures(n, textures);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int glGetError() {
|
||||
public int getError() {
|
||||
return GLES20.glGetError();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glGetIntegerv(int pname, IntBuffer params) {
|
||||
public void getIntegerv(int pname, IntBuffer params) {
|
||||
GLES20.glGetIntegerv(pname, params);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String glGetString(int name) {
|
||||
public String getString(int name) {
|
||||
return GLES20.glGetString(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glHint(int target, int mode) {
|
||||
public void hint(int target, int mode) {
|
||||
GLES20.glHint(target, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glLineWidth(float width) {
|
||||
public void lineWidth(float width) {
|
||||
GLES20.glLineWidth(width);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glPixelStorei(int pname, int param) {
|
||||
public void pixelStorei(int pname, int param) {
|
||||
GLES20.glPixelStorei(pname, param);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glPolygonOffset(float factor, float units) {
|
||||
public void polygonOffset(float factor, float units) {
|
||||
GLES20.glPolygonOffset(factor, units);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glReadPixels(int x, int y, int width, int height, int format, int type,
|
||||
public void readPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
GLES20.glReadPixels(x, y, width, height, format, type, pixels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glScissor(int x, int y, int width, int height) {
|
||||
public void scissor(int x, int y, int width, int height) {
|
||||
GLES20.glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glStencilFunc(int func, int ref, int mask) {
|
||||
public void stencilFunc(int func, int ref, int mask) {
|
||||
GLES20.glStencilFunc(func, ref, mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glStencilMask(int mask) {
|
||||
public void stencilMask(int mask) {
|
||||
GLES20.glStencilMask(mask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glStencilOp(int fail, int zfail, int zpass) {
|
||||
public void stencilOp(int fail, int zfail, int zpass) {
|
||||
GLES20.glStencilOp(fail, zfail, zpass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glTexImage2D(int target, int level, int internalformat, int width, int height,
|
||||
public void texImage2D(int target, int level, int internalformat, int width, int height,
|
||||
int border, int format, int type, Buffer pixels) {
|
||||
GLES20.glTexImage2D(target, level, internalformat, width, height, border, format, type,
|
||||
pixels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glTexParameterf(int target, int pname, float param) {
|
||||
public void texParameterf(int target, int pname, float param) {
|
||||
GLES20.glTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void glViewport(int x, int y, int width, int height) {
|
||||
public void viewport(int x, int y, int width, int height) {
|
||||
GLES20.glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
|
@ -24,11 +24,11 @@ import java.nio.IntBuffer;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.renderer.bucket.TextureBucket;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.utils.BufferUtils;
|
||||
|
||||
public class AwtBitmap implements Bitmap {
|
||||
@ -77,8 +77,9 @@ public class AwtBitmap implements Bitmap {
|
||||
public void eraseColor(int transparent) {
|
||||
}
|
||||
|
||||
private final static IntBuffer tmpBuffer = BufferUtils.newIntBuffer(TextureBucket.TEXTURE_HEIGHT
|
||||
* TextureBucket.TEXTURE_WIDTH);
|
||||
private final static IntBuffer tmpBuffer = BufferUtils
|
||||
.newIntBuffer(TextureBucket.TEXTURE_HEIGHT
|
||||
* TextureBucket.TEXTURE_WIDTH);
|
||||
private final static int[] tmpPixel = new int[TextureBucket.TEXTURE_HEIGHT
|
||||
* TextureBucket.TEXTURE_WIDTH];
|
||||
|
||||
@ -128,8 +129,8 @@ public class AwtBitmap implements Bitmap {
|
||||
buffer.put(pixels, 0, width * height);
|
||||
buffer.flip();
|
||||
|
||||
Gdx.gl20.glTexImage2D(GL20.GL_TEXTURE_2D, 0, GL20.GL_RGBA, width,
|
||||
height, 0, GL20.GL_RGBA, GL20.GL_UNSIGNED_BYTE, buffer);
|
||||
Gdx.gl20.glTexImage2D(GL.TEXTURE_2D, 0, GL.RGBA, width,
|
||||
height, 0, GL.RGBA, GL.UNSIGNED_BYTE, buffer);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
763
vtm-desktop/src/org/oscim/gdx/GdxGL.java
Normal file
763
vtm-desktop/src/org/oscim/gdx/GdxGL.java
Normal file
@ -0,0 +1,763 @@
|
||||
package org.oscim.gdx;
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 2011 See AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
import static com.badlogic.jglfw.utils.Memory.getPosition;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
|
||||
public class GdxGL implements GL {
|
||||
public void activeTexture(int texture) {
|
||||
com.badlogic.jglfw.gl.GL.glActiveTexture(texture);
|
||||
}
|
||||
|
||||
public void bindTexture(int target, int texture) {
|
||||
com.badlogic.jglfw.gl.GL.glBindTexture(target, texture);
|
||||
}
|
||||
|
||||
public void blendFunc(int sfactor, int dfactor) {
|
||||
com.badlogic.jglfw.gl.GL.glBlendFunc(sfactor, dfactor);
|
||||
}
|
||||
|
||||
public void clear(int mask) {
|
||||
com.badlogic.jglfw.gl.GL.glClear(mask);
|
||||
}
|
||||
|
||||
public void clearColor(float red, float green, float blue, float alpha) {
|
||||
com.badlogic.jglfw.gl.GL.glClearColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void clearDepthf(float depth) {
|
||||
com.badlogic.jglfw.gl.GL.glClearDepthf(depth);
|
||||
}
|
||||
|
||||
public void clearStencil(int s) {
|
||||
com.badlogic.jglfw.gl.GL.glClearStencil(s);
|
||||
}
|
||||
|
||||
public void colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
com.badlogic.jglfw.gl.GL.glColorMask(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void compressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border,
|
||||
int imageSize, Buffer data) {
|
||||
com.badlogic.jglfw.gl.GL.glCompressedTexImage2D(
|
||||
target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
imageSize,
|
||||
data,
|
||||
getPosition(data));
|
||||
}
|
||||
|
||||
public void compressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format,
|
||||
int imageSize, Buffer data) {
|
||||
com.badlogic.jglfw.gl.GL.glCompressedTexSubImage2D(
|
||||
target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
imageSize,
|
||||
data,
|
||||
getPosition(data));
|
||||
}
|
||||
|
||||
public void copyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border) {
|
||||
com.badlogic.jglfw.gl.GL.glCopyTexImage2D(
|
||||
target,
|
||||
level,
|
||||
internalformat,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
border);
|
||||
}
|
||||
|
||||
public void copyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height) {
|
||||
com.badlogic.jglfw.gl.GL.glCopyTexSubImage2D(
|
||||
target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
|
||||
public void cullFace(int mode) {
|
||||
com.badlogic.jglfw.gl.GL.glCullFace(mode);
|
||||
}
|
||||
|
||||
public void deleteTextures(int n, IntBuffer textures) {
|
||||
com.badlogic.jglfw.gl.GL.glDeleteTextures(n, textures, getPosition(textures));
|
||||
}
|
||||
|
||||
public void depthFunc(int func) {
|
||||
com.badlogic.jglfw.gl.GL.glDepthFunc(func);
|
||||
}
|
||||
|
||||
public void depthMask(boolean flag) {
|
||||
com.badlogic.jglfw.gl.GL.glDepthMask(flag);
|
||||
}
|
||||
|
||||
public void depthRangef(float zNear, float zFar) {
|
||||
com.badlogic.jglfw.gl.GL.glDepthRangef(zNear, zFar);
|
||||
}
|
||||
|
||||
public void disable(int cap) {
|
||||
com.badlogic.jglfw.gl.GL.glDisable(cap);
|
||||
}
|
||||
|
||||
public void drawArrays(int mode, int first, int count) {
|
||||
com.badlogic.jglfw.gl.GL.glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public void drawElements(int mode, int count, int type, Buffer indices) {
|
||||
com.badlogic.jglfw.gl.GL.glDrawElements(mode, count, type, indices, getPosition(indices));
|
||||
}
|
||||
|
||||
public void enable(int cap) {
|
||||
com.badlogic.jglfw.gl.GL.glEnable(cap);
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
com.badlogic.jglfw.gl.GL.glFinish();
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
com.badlogic.jglfw.gl.GL.glFlush();
|
||||
}
|
||||
|
||||
public void frontFace(int mode) {
|
||||
com.badlogic.jglfw.gl.GL.glFrontFace(mode);
|
||||
}
|
||||
|
||||
public void genTextures(int n, IntBuffer textures) {
|
||||
com.badlogic.jglfw.gl.GL.glGenTextures(n, textures, getPosition(textures));
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return com.badlogic.jglfw.gl.GL.glGetError();
|
||||
}
|
||||
|
||||
public void getIntegerv(int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetIntegerv(pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public String getString(int name) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetString(name);
|
||||
}
|
||||
|
||||
public void hint(int target, int mode) {
|
||||
com.badlogic.jglfw.gl.GL.glHint(target, mode);
|
||||
}
|
||||
|
||||
public void lineWidth(float width) {
|
||||
com.badlogic.jglfw.gl.GL.glLineWidth(width);
|
||||
}
|
||||
|
||||
public void pixelStorei(int pname, int param) {
|
||||
com.badlogic.jglfw.gl.GL.glPixelStorei(pname, param);
|
||||
}
|
||||
|
||||
public void polygonOffset(float factor, float units) {
|
||||
com.badlogic.jglfw.gl.GL.glPolygonOffset(factor, units);
|
||||
}
|
||||
|
||||
public void readPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
com.badlogic.jglfw.gl.GL.glReadPixels(
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
pixels,
|
||||
getPosition(pixels));
|
||||
}
|
||||
|
||||
public void scissor(int x, int y, int width, int height) {
|
||||
com.badlogic.jglfw.gl.GL.glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
public void stencilFunc(int func, int ref, int mask) {
|
||||
com.badlogic.jglfw.gl.GL.glStencilFunc(func, ref, mask);
|
||||
}
|
||||
|
||||
public void stencilMask(int mask) {
|
||||
com.badlogic.jglfw.gl.GL.glStencilMask(mask);
|
||||
}
|
||||
|
||||
public void stencilOp(int fail, int zfail, int zpass) {
|
||||
com.badlogic.jglfw.gl.GL.glStencilOp(fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void texImage2D(int target, int level, int internalFormat, int width, int height,
|
||||
int border, int format, int type,
|
||||
Buffer pixels) {
|
||||
com.badlogic.jglfw.gl.GL.glTexImage2D(
|
||||
target,
|
||||
level,
|
||||
internalFormat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
format,
|
||||
type,
|
||||
pixels,
|
||||
getPosition(pixels));
|
||||
}
|
||||
|
||||
public void texParameterf(int target, int pname, float param) {
|
||||
com.badlogic.jglfw.gl.GL.glTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
public void texSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
com.badlogic.jglfw.gl.GL.glTexSubImage2D(
|
||||
target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
pixels,
|
||||
getPosition(pixels));
|
||||
}
|
||||
|
||||
public void viewport(int x, int y, int width, int height) {
|
||||
com.badlogic.jglfw.gl.GL.glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
public void getFloatv(int pname, FloatBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetFloatv(pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void getTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetTexParameterfv(target, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void texParameterfv(int target, int pname, FloatBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glTexParameterfv(target, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void bindBuffer(int target, int buffer) {
|
||||
com.badlogic.jglfw.gl.GL.glBindBuffer(target, buffer);
|
||||
}
|
||||
|
||||
public void bufferData(int target, int size, Buffer data, int usage) {
|
||||
com.badlogic.jglfw.gl.GL.glBufferData(target, size, data, getPosition(data), usage);
|
||||
}
|
||||
|
||||
public void bufferSubData(int target, int offset, int size, Buffer data) {
|
||||
com.badlogic.jglfw.gl.GL.glBufferSubData(target, offset, size, data, getPosition(data));
|
||||
}
|
||||
|
||||
public void deleteBuffers(int n, IntBuffer buffers) {
|
||||
com.badlogic.jglfw.gl.GL.glDeleteBuffers(n, buffers, getPosition(buffers));
|
||||
}
|
||||
|
||||
public void getBufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetBufferParameteriv(target, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void genBuffers(int n, IntBuffer buffers) {
|
||||
com.badlogic.jglfw.gl.GL.glGenBuffers(n, buffers, getPosition(buffers));
|
||||
}
|
||||
|
||||
public void getTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetTexParameteriv(target, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public boolean isBuffer(int buffer) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsBuffer(buffer);
|
||||
}
|
||||
|
||||
public boolean isEnabled(int cap) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsEnabled(cap);
|
||||
}
|
||||
|
||||
public boolean isTexture(int texture) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsTexture(texture);
|
||||
}
|
||||
|
||||
public void texParameteri(int target, int pname, int param) {
|
||||
com.badlogic.jglfw.gl.GL.glTexParameteri(target, pname, param);
|
||||
}
|
||||
|
||||
public void texParameteriv(int target, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glTexParameteriv(target, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void drawElements(int mode, int count, int type, int indices) {
|
||||
com.badlogic.jglfw.gl.GL.glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
public void attachShader(int program, int shader) {
|
||||
com.badlogic.jglfw.gl.GL.glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
public void bindAttribLocation(int program, int index, String name) {
|
||||
com.badlogic.jglfw.gl.GL.glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
public void bindFramebuffer(int target, int framebuffer) {
|
||||
com.badlogic.jglfw.gl.GL.glBindFramebufferEXT(target, framebuffer);
|
||||
}
|
||||
|
||||
public void bindRenderbuffer(int target, int renderbuffer) {
|
||||
com.badlogic.jglfw.gl.GL.glBindRenderbufferEXT(target, renderbuffer);
|
||||
}
|
||||
|
||||
public void blendColor(float red, float green, float blue, float alpha) {
|
||||
com.badlogic.jglfw.gl.GL.glBlendColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void blendEquation(int mode) {
|
||||
com.badlogic.jglfw.gl.GL.glBlendEquation(mode);
|
||||
}
|
||||
|
||||
public void blendEquationSeparate(int modeRGB, int modeAlpha) {
|
||||
com.badlogic.jglfw.gl.GL.glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
}
|
||||
|
||||
public void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
com.badlogic.jglfw.gl.GL.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
public int checkFramebufferStatus(int target) {
|
||||
return com.badlogic.jglfw.gl.GL.glCheckFramebufferStatusEXT(target);
|
||||
}
|
||||
|
||||
public void compileShader(int shader) {
|
||||
com.badlogic.jglfw.gl.GL.glCompileShader(shader);
|
||||
}
|
||||
|
||||
public int createProgram() {
|
||||
return com.badlogic.jglfw.gl.GL.glCreateProgram();
|
||||
}
|
||||
|
||||
public int createShader(int type) {
|
||||
return com.badlogic.jglfw.gl.GL.glCreateShader(type);
|
||||
}
|
||||
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
com.badlogic.jglfw.gl.GL
|
||||
.glDeleteFramebuffersEXT(n, framebuffers, getPosition(framebuffers));
|
||||
}
|
||||
|
||||
public void deleteProgram(int program) {
|
||||
com.badlogic.jglfw.gl.GL.glDeleteProgram(program);
|
||||
}
|
||||
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
com.badlogic.jglfw.gl.GL.glDeleteRenderbuffersEXT(
|
||||
n,
|
||||
renderbuffers,
|
||||
getPosition(renderbuffers));
|
||||
}
|
||||
|
||||
public void deleteShader(int shader) {
|
||||
com.badlogic.jglfw.gl.GL.glDeleteShader(shader);
|
||||
}
|
||||
|
||||
public void detachShader(int program, int shader) {
|
||||
com.badlogic.jglfw.gl.GL.glDetachShader(program, shader);
|
||||
}
|
||||
|
||||
public void disableVertexAttribArray(int index) {
|
||||
com.badlogic.jglfw.gl.GL.glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void enableVertexAttribArray(int index) {
|
||||
com.badlogic.jglfw.gl.GL.glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer) {
|
||||
com.badlogic.jglfw.gl.GL.glFramebufferRenderbufferEXT(
|
||||
target,
|
||||
attachment,
|
||||
renderbuffertarget,
|
||||
renderbuffer);
|
||||
}
|
||||
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level) {
|
||||
com.badlogic.jglfw.gl.GL.glFramebufferTexture2DEXT(
|
||||
target,
|
||||
attachment,
|
||||
textarget,
|
||||
texture,
|
||||
level);
|
||||
}
|
||||
|
||||
public void generateMipmap(int target) {
|
||||
com.badlogic.jglfw.gl.GL.glGenerateMipmapEXT(target);
|
||||
}
|
||||
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
com.badlogic.jglfw.gl.GL.glGenFramebuffersEXT(n, framebuffers, getPosition(framebuffers));
|
||||
}
|
||||
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
com.badlogic.jglfw.gl.GL
|
||||
.glGenRenderbuffersEXT(n, renderbuffers, getPosition(renderbuffers));
|
||||
}
|
||||
|
||||
public String getActiveAttrib(int program, int index, IntBuffer size, Buffer type) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetActiveAttrib(
|
||||
program,
|
||||
index,
|
||||
size,
|
||||
getPosition(size),
|
||||
type,
|
||||
getPosition(type));
|
||||
}
|
||||
|
||||
public String getActiveUniform(int program, int index, IntBuffer size, Buffer type) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetActiveUniform(
|
||||
program,
|
||||
index,
|
||||
size,
|
||||
getPosition(size),
|
||||
type,
|
||||
getPosition(type));
|
||||
}
|
||||
|
||||
public void getAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
com.badlogic.jglfw.gl.GL.glGetAttachedShaders(
|
||||
program,
|
||||
maxcount,
|
||||
count,
|
||||
getPosition(count),
|
||||
shaders,
|
||||
getPosition(shaders));
|
||||
}
|
||||
|
||||
public int getAttribLocation(int program, String name) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
public void getBooleanv(int pname, Buffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetBooleanv(pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void getFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetFramebufferAttachmentParameterivEXT(
|
||||
target,
|
||||
attachment,
|
||||
pname,
|
||||
params,
|
||||
getPosition(params));
|
||||
}
|
||||
|
||||
public void getProgramiv(int program, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetProgramiv(program, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public String getProgramInfoLog(int program) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetProgramInfoLog(program);
|
||||
}
|
||||
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetRenderbufferParameterivEXT(
|
||||
target,
|
||||
pname,
|
||||
params,
|
||||
getPosition(params));
|
||||
}
|
||||
|
||||
public void getShaderiv(int shader, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetShaderiv(shader, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public String getShaderInfoLog(int shader) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetShaderInfoLog(shader);
|
||||
}
|
||||
|
||||
public void getShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision) {
|
||||
com.badlogic.jglfw.gl.GL.glGetShaderPrecisionFormat(
|
||||
shadertype,
|
||||
precisiontype,
|
||||
range,
|
||||
getPosition(range),
|
||||
precision,
|
||||
getPosition(precision));
|
||||
}
|
||||
|
||||
public void getShaderSource(int shader, int bufsize, Buffer length, String source) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
public void getUniformfv(int program, int location, FloatBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetUniformfv(program, location, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void getUniformiv(int program, int location, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetUniformiv(program, location, params, getPosition(params));
|
||||
}
|
||||
|
||||
public int getUniformLocation(int program, String name) {
|
||||
return com.badlogic.jglfw.gl.GL.glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
public void getVertexAttribfv(int index, int pname, FloatBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetVertexAttribfv(index, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void getVertexAttribiv(int index, int pname, IntBuffer params) {
|
||||
com.badlogic.jglfw.gl.GL.glGetVertexAttribiv(index, pname, params, getPosition(params));
|
||||
}
|
||||
|
||||
public void getVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
com.badlogic.jglfw.gl.GL.glGetVertexAttribPointerv(
|
||||
index,
|
||||
pname,
|
||||
pointer,
|
||||
getPosition(pointer));
|
||||
}
|
||||
|
||||
public boolean isFramebuffer(int framebuffer) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsFramebufferEXT(framebuffer);
|
||||
}
|
||||
|
||||
public boolean isProgram(int program) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsProgram(program);
|
||||
}
|
||||
|
||||
public boolean isRenderbuffer(int renderbuffer) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsRenderbufferEXT(renderbuffer);
|
||||
}
|
||||
|
||||
public boolean isShader(int shader) {
|
||||
return com.badlogic.jglfw.gl.GL.glIsShader(shader);
|
||||
}
|
||||
|
||||
public void linkProgram(int program) {
|
||||
com.badlogic.jglfw.gl.GL.glLinkProgram(program);
|
||||
}
|
||||
|
||||
public void releaseShaderCompiler() {
|
||||
com.badlogic.jglfw.gl.GL.glReleaseShaderCompiler();
|
||||
}
|
||||
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
com.badlogic.jglfw.gl.GL.glRenderbufferStorageEXT(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
public void sampleCoverage(float value, boolean invert) {
|
||||
com.badlogic.jglfw.gl.GL.glSampleCoverage(value, invert);
|
||||
}
|
||||
|
||||
public void shaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
com.badlogic.jglfw.gl.GL.glShaderBinary(
|
||||
n,
|
||||
shaders,
|
||||
getPosition(shaders),
|
||||
binaryformat,
|
||||
binary,
|
||||
getPosition(binary),
|
||||
length);
|
||||
}
|
||||
|
||||
public void shaderSource(int shader, String string) {
|
||||
com.badlogic.jglfw.gl.GL.glShaderSource(shader, string);
|
||||
}
|
||||
|
||||
public void stencilFuncSeparate(int face, int func, int ref, int mask) {
|
||||
com.badlogic.jglfw.gl.GL.glStencilFuncSeparate(face, func, ref, mask);
|
||||
}
|
||||
|
||||
public void stencilMaskSeparate(int face, int mask) {
|
||||
com.badlogic.jglfw.gl.GL.glStencilMaskSeparate(face, mask);
|
||||
}
|
||||
|
||||
public void stencilOpSeparate(int face, int fail, int zfail, int zpass) {
|
||||
com.badlogic.jglfw.gl.GL.glStencilOpSeparate(face, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void uniform1f(int location, float x) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform1f(location, x);
|
||||
}
|
||||
|
||||
public void uniform1fv(int location, int count, FloatBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform1fv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform1i(int location, int x) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform1i(location, x);
|
||||
}
|
||||
|
||||
public void uniform1iv(int location, int count, IntBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform1iv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform2f(int location, float x, float y) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform2f(location, x, y);
|
||||
}
|
||||
|
||||
public void uniform2fv(int location, int count, FloatBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform2fv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform2i(int location, int x, int y) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform2i(location, x, y);
|
||||
}
|
||||
|
||||
public void uniform2iv(int location, int count, IntBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform2iv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform3f(int location, float x, float y, float z) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform3f(location, x, y, z);
|
||||
}
|
||||
|
||||
public void uniform3fv(int location, int count, FloatBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform3fv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform3i(int location, int x, int y, int z) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform3i(location, x, y, z);
|
||||
}
|
||||
|
||||
public void uniform3iv(int location, int count, IntBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform3iv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform4f(int location, float x, float y, float z, float w) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform4f(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void uniform4fv(int location, int count, FloatBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform4fv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniform4i(int location, int x, int y, int z, int w) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform4i(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void uniform4iv(int location, int count, IntBuffer v) {
|
||||
com.badlogic.jglfw.gl.GL.glUniform4iv(location, count, v, getPosition(v));
|
||||
}
|
||||
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
com.badlogic.jglfw.gl.GL.glUniformMatrix2fv(
|
||||
location,
|
||||
count,
|
||||
transpose,
|
||||
value,
|
||||
getPosition(value));
|
||||
}
|
||||
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
com.badlogic.jglfw.gl.GL.glUniformMatrix3fv(
|
||||
location,
|
||||
count,
|
||||
transpose,
|
||||
value,
|
||||
getPosition(value));
|
||||
}
|
||||
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
com.badlogic.jglfw.gl.GL.glUniformMatrix4fv(
|
||||
location,
|
||||
count,
|
||||
transpose,
|
||||
value,
|
||||
getPosition(value));
|
||||
}
|
||||
|
||||
public void useProgram(int program) {
|
||||
com.badlogic.jglfw.gl.GL.glUseProgram(program);
|
||||
}
|
||||
|
||||
public void validateProgram(int program) {
|
||||
com.badlogic.jglfw.gl.GL.glValidateProgram(program);
|
||||
}
|
||||
|
||||
public void vertexAttrib1f(int indx, float x) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib1f(indx, x);
|
||||
}
|
||||
|
||||
public void vertexAttrib1fv(int indx, FloatBuffer values) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib1fv(indx, values, getPosition(values));
|
||||
}
|
||||
|
||||
public void vertexAttrib2f(int indx, float x, float y) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib2f(indx, x, y);
|
||||
}
|
||||
|
||||
public void vertexAttrib2fv(int indx, FloatBuffer values) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib2fv(indx, values, getPosition(values));
|
||||
}
|
||||
|
||||
public void vertexAttrib3f(int indx, float x, float y, float z) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib3f(indx, x, y, z);
|
||||
}
|
||||
|
||||
public void vertexAttrib3fv(int indx, FloatBuffer values) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib3fv(indx, values, getPosition(values));
|
||||
}
|
||||
|
||||
public void vertexAttrib4f(int indx, float x, float y, float z, float w) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib4f(indx, x, y, z, w);
|
||||
}
|
||||
|
||||
public void vertexAttrib4fv(int indx, FloatBuffer values) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttrib4fv(indx, values, getPosition(values));
|
||||
}
|
||||
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer ptr) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttribPointer(
|
||||
indx,
|
||||
size,
|
||||
type,
|
||||
normalized,
|
||||
stride,
|
||||
ptr,
|
||||
getPosition(ptr));
|
||||
}
|
||||
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int ptr) {
|
||||
com.badlogic.jglfw.gl.GL.glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@
|
||||
package org.oscim.gdx;
|
||||
|
||||
import org.oscim.awt.AwtGraphics;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.tiling.TileSource;
|
||||
@ -28,24 +27,19 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.badlogic.gdx.backends.jglfw.JglfwApplication;
|
||||
import com.badlogic.gdx.backends.jglfw.JglfwApplicationConfiguration;
|
||||
import com.badlogic.gdx.backends.jglfw.JglfwGL20;
|
||||
import com.badlogic.gdx.utils.SharedLibraryLoader;
|
||||
|
||||
public class GdxMapApp extends GdxMap {
|
||||
|
||||
public static final Logger log = LoggerFactory.getLogger(GdxMapApp.class);
|
||||
|
||||
static class GdxGL20Wrapper extends JglfwGL20 implements GL20 {
|
||||
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
// load native library
|
||||
new SharedLibraryLoader().load("vtm-jni");
|
||||
// init globals
|
||||
AwtGraphics.init();
|
||||
GdxAssets.init("assets/");
|
||||
GLAdapter.init(new GdxGL20Wrapper());
|
||||
GLAdapter.init(new GdxGL());
|
||||
GLAdapter.GDX_DESKTOP_QUIRKS = true;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class IosBitmap implements Bitmap {
|
||||
@Override
|
||||
public void uploadToTexture(boolean replace) {
|
||||
|
||||
Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_2D, 0, pixmap.getGLInternalFormat(),
|
||||
Gdx.gl.glTexImage2D(GL20.TEXTURE_2D, 0, pixmap.getGLInternalFormat(),
|
||||
pixmap.getWidth(), pixmap.getHeight(), 0,
|
||||
pixmap.getGLFormat(), pixmap.getGLType(),
|
||||
pixmap.getPixels());
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.oscim.test.gdx.poi3d;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.map.Viewport;
|
||||
@ -93,12 +95,12 @@ public class GdxModelRenderer extends LayerRenderer {
|
||||
|
||||
// GLUtils.checkGlError(">" + TAG);
|
||||
|
||||
GL.glDepthMask(true);
|
||||
gl.depthMask(true);
|
||||
|
||||
if (v.pos.zoomLevel < 16)
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
// set state that is expected after modelBatch.end();
|
||||
// modelBatch keeps track of its own state
|
||||
@ -168,9 +170,9 @@ public class GdxModelRenderer extends LayerRenderer {
|
||||
//renderContext.end();
|
||||
}
|
||||
|
||||
GL.glDepthMask(false);
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
gl.depthMask(false);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.oscim.test.gdx.poi3d;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.map.Viewport;
|
||||
@ -94,12 +96,12 @@ public class GdxRenderer3D extends LayerRenderer {
|
||||
|
||||
// GLUtils.checkGlError(">" + TAG);
|
||||
|
||||
GL.glDepthMask(true);
|
||||
gl.depthMask(true);
|
||||
|
||||
// if (position.zoomLevel < 17)
|
||||
// GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
// GL.clear(GL20.DEPTH_BUFFER_BIT);
|
||||
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
// set state that is expected after modelBatch.end();
|
||||
// modelBatch keeps track of its own state
|
||||
@ -182,9 +184,9 @@ public class GdxRenderer3D extends LayerRenderer {
|
||||
}
|
||||
log.debug(">>> " + (System.currentTimeMillis() - time) + " " + cnt + "/" + rnd);
|
||||
|
||||
GL.glDepthMask(false);
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
gl.depthMask(false);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -1,6 +1,8 @@
|
||||
package org.oscim.test.gdx.poi3d;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.map.Viewport;
|
||||
@ -84,12 +86,12 @@ public class GdxRenderer3D2 extends LayerRenderer {
|
||||
|
||||
// GLUtils.checkGlError(">" + TAG);
|
||||
|
||||
GL.glDepthMask(true);
|
||||
gl.depthMask(true);
|
||||
|
||||
if (v.pos.zoomLevel < 17)
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
||||
// set state that is expected after modelBatch.end();
|
||||
// modelBatch keeps track of its own state
|
||||
@ -99,8 +101,8 @@ public class GdxRenderer3D2 extends LayerRenderer {
|
||||
GLState.test(false, false);
|
||||
GLState.blend(false);
|
||||
|
||||
// GL.glCullFace(GL20.GL_BACK);
|
||||
// GL.glFrontFace(GL20.GL_CW);
|
||||
// GL.cullFace(GL20.BACK);
|
||||
// GL.frontFace(GL20.CW);
|
||||
|
||||
cam.update(v);
|
||||
long time = System.currentTimeMillis();
|
||||
@ -145,9 +147,9 @@ public class GdxRenderer3D2 extends LayerRenderer {
|
||||
|
||||
// GLUtils.checkGlError("<" + TAG);
|
||||
|
||||
GL.glDepthMask(false);
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
gl.depthMask(false);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
||||
|
||||
// GLState.bindTex2D(-1);
|
||||
// GLState.useProgram(-1);
|
||||
|
@ -16,11 +16,13 @@
|
||||
*/
|
||||
package org.oscim.test.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.map.Map;
|
||||
import org.oscim.renderer.GLShader;
|
||||
@ -95,13 +97,13 @@ public class CustomRenderer extends LayerRenderer {
|
||||
GLState.test(false, false);
|
||||
|
||||
// unbind previously bound VBOs
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
|
||||
gl.bindBuffer(GL.ARRAY_BUFFER, 0);
|
||||
|
||||
// Load the vertex data
|
||||
//mVertices.position(0);
|
||||
GL.glVertexAttribPointer(hVertexPosition, 3, GL20.GL_FLOAT, false, 0, mVertices);
|
||||
gl.vertexAttribPointer(hVertexPosition, 3, GL.FLOAT, false, 0, mVertices);
|
||||
//mVertices.position(2);
|
||||
//GL.glVertexAttribPointer(hVertexPosition, 2, GL20.GL_FLOAT, false, 4, mVertices);
|
||||
//GL.vertexAttribPointer(hVertexPosition, 2, GL20.FLOAT, false, 4, mVertices);
|
||||
|
||||
GLState.enableVertexArrays(hVertexPosition, -1);
|
||||
|
||||
@ -116,7 +118,7 @@ public class CustomRenderer extends LayerRenderer {
|
||||
v.mvp.setAsUniform(hMatrixPosition);
|
||||
|
||||
// Draw the triangle
|
||||
GL.glDrawArrays(GL20.GL_TRIANGLE_STRIP, 0, 4);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
GLUtils.checkGlError("...");
|
||||
}
|
||||
@ -129,9 +131,9 @@ public class CustomRenderer extends LayerRenderer {
|
||||
return false;
|
||||
|
||||
// Handle for vertex position in shader
|
||||
hVertexPosition = GL.glGetAttribLocation(programObject, "a_pos");
|
||||
hVertexPosition = gl.getAttribLocation(programObject, "a_pos");
|
||||
|
||||
hMatrixPosition = GL.glGetUniformLocation(programObject, "u_mvp");
|
||||
hMatrixPosition = gl.getUniformLocation(programObject, "u_mvp");
|
||||
|
||||
// Store the program object
|
||||
mProgramObject = programObject;
|
||||
|
@ -1,8 +1,10 @@
|
||||
package org.oscim.test.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.gdx.GdxMap;
|
||||
import org.oscim.gdx.GdxMapApp;
|
||||
@ -80,7 +82,7 @@ public class HexagonRenderTest extends GdxMap {
|
||||
FloatBuffer buf = MapRenderer.getFloatBuffer(12);
|
||||
buf.put(vertices);
|
||||
|
||||
mVBO = BufferObject.get(GL20.GL_ARRAY_BUFFER, 0);
|
||||
mVBO = BufferObject.get(GL.ARRAY_BUFFER, 0);
|
||||
mVBO.loadBufferData(buf.flip(), 12 * 4);
|
||||
|
||||
setReady(true);
|
||||
@ -99,7 +101,7 @@ public class HexagonRenderTest extends GdxMap {
|
||||
mVBO.bind();
|
||||
|
||||
// set VBO vertex layout
|
||||
GL.glVertexAttribPointer(hVertexPosition, 2, GL20.GL_FLOAT, false, 0, 0);
|
||||
gl.vertexAttribPointer(hVertexPosition, 2, GL.FLOAT, false, 0, 0);
|
||||
|
||||
GLState.enableVertexArrays(hVertexPosition, -1);
|
||||
|
||||
@ -118,7 +120,7 @@ public class HexagonRenderTest extends GdxMap {
|
||||
float xx = x * 2 + (y % 2 == 0 ? 1 : 0);
|
||||
float yy = y * h + h / 2;
|
||||
|
||||
GL.glUniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale);
|
||||
gl.uniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale);
|
||||
|
||||
//float alpha = 1 + (float) Math.log10(FastMath.clamp(
|
||||
// (float) Math.sqrt(xx * xx + yy * yy) / offset_y, 0.0f, 1.0f)) * 2;
|
||||
@ -141,7 +143,7 @@ public class HexagonRenderTest extends GdxMap {
|
||||
|
||||
GLUtils.setColor(hColorPosition, c, alpha);
|
||||
|
||||
GL.glDrawArrays(GL20.GL_TRIANGLE_FAN, 0, 6);
|
||||
gl.drawArrays(GL.TRIANGLE_FAN, 0, 6);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,8 +154,8 @@ public class HexagonRenderTest extends GdxMap {
|
||||
float xx = x * 2 + (y % 2 == 0 ? 1 : 0);
|
||||
float yy = y * h + h / 2;
|
||||
|
||||
GL.glUniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale);
|
||||
GL.glDrawArrays(GL20.GL_LINE_LOOP, 0, 6);
|
||||
gl.uniform2f(hCenterPosition, xx * (mCellScale * 1.5f), yy * mCellScale);
|
||||
gl.drawArrays(GL.LINE_LOOP, 0, 6);
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,13 +170,13 @@ public class HexagonRenderTest extends GdxMap {
|
||||
return false;
|
||||
|
||||
// Handle for vertex position in shader
|
||||
hVertexPosition = GL.glGetAttribLocation(programObject, "a_pos");
|
||||
hVertexPosition = gl.getAttribLocation(programObject, "a_pos");
|
||||
|
||||
hMatrixPosition = GL.glGetUniformLocation(programObject, "u_mvp");
|
||||
hMatrixPosition = gl.getUniformLocation(programObject, "u_mvp");
|
||||
|
||||
hColorPosition = GL.glGetUniformLocation(programObject, "u_color");
|
||||
hColorPosition = gl.getUniformLocation(programObject, "u_color");
|
||||
|
||||
hCenterPosition = GL.glGetUniformLocation(programObject, "u_center");
|
||||
hCenterPosition = gl.getUniformLocation(programObject, "u_center");
|
||||
|
||||
// Store the program object
|
||||
mProgramObject = programObject;
|
||||
|
@ -17,7 +17,7 @@
|
||||
package org.oscim.web.client;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
@ -63,7 +63,7 @@ class GwtMap extends GdxMap {
|
||||
GdxAssets.init("");
|
||||
CanvasAdapter.textScale = 0.7f;
|
||||
|
||||
GLAdapter.init((GL20) Gdx.graphics.getGL20());
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
//Gdx.app.setLogLevel(Application.LOG_DEBUG);
|
||||
|
@ -17,7 +17,7 @@
|
||||
package org.oscim.web.client;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.gdx.GdxAssets;
|
||||
@ -42,7 +42,7 @@ public class GwtMap extends GdxMap {
|
||||
GwtGdxGraphics.init();
|
||||
GdxAssets.init("");
|
||||
CanvasAdapter.textScale = 0.7f;
|
||||
GLAdapter.init((GL20) Gdx.graphics.getGL20());
|
||||
GLAdapter.init((GL) Gdx.graphics.getGL20());
|
||||
GLAdapter.GDX_WEBGL_QUIRKS = true;
|
||||
MapRenderer.setBackgroundColor(0xffffff);
|
||||
|
||||
|
719
vtm-web/src/org/oscim/gdx/client/GdxGL.java
Normal file
719
vtm-web/src/org/oscim/gdx/client/GdxGL.java
Normal file
@ -0,0 +1,719 @@
|
||||
package org.oscim.gdx.client;
|
||||
|
||||
/*******************************************************************************
|
||||
* Copyright 2011 See AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
|
||||
import com.badlogic.gdx.backends.gwt.GwtGL20;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.google.gwt.typedarrays.client.Uint8ArrayNative;
|
||||
import com.google.gwt.webgl.client.WebGLRenderingContext;
|
||||
|
||||
public class GdxGL extends GwtGL20 implements GL {
|
||||
|
||||
protected final WebGLRenderingContext gl;
|
||||
|
||||
public GdxGL(WebGLRenderingContext gl) {
|
||||
super(gl);
|
||||
gl.pixelStorei(WebGLRenderingContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
|
||||
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) {
|
||||
|
||||
if (pixels == null) {
|
||||
gl.texImage2D(target, level, internalformat,
|
||||
width, height, border, format,
|
||||
type, null);
|
||||
return;
|
||||
}
|
||||
|
||||
Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer) pixels).get(0));
|
||||
if (pixmap != null) {
|
||||
gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
|
||||
} else if (format == GL.ALPHA) {
|
||||
int tmp[] = new int[(width * height) >> 2];
|
||||
((IntBuffer) pixels).get(tmp);
|
||||
|
||||
Uint8ArrayNative v = com.google.gwt.typedarrays.client.Uint8ArrayNative.create(width
|
||||
* height);
|
||||
|
||||
for (int i = 0, n = (width * height) >> 2; i < n; i++) {
|
||||
v.set(i * 4 + 3, (tmp[i] >> 24) & 0xff);
|
||||
v.set(i * 4 + 2, (tmp[i] >> 16) & 0xff);
|
||||
v.set(i * 4 + 1, (tmp[i] >> 8) & 0xff);
|
||||
v.set(i * 4 + 0, (tmp[i]) & 0xff);
|
||||
}
|
||||
gl.texImage2D(target, level, internalformat, width, height, 0, format, type, v);
|
||||
}
|
||||
}
|
||||
|
||||
public void activeTexture(int texture) {
|
||||
glActiveTexture(texture);
|
||||
}
|
||||
|
||||
public void bindTexture(int target, int texture) {
|
||||
glBindTexture(target, texture);
|
||||
}
|
||||
|
||||
public void blendFunc(int sfactor, int dfactor) {
|
||||
glBlendFunc(sfactor, dfactor);
|
||||
}
|
||||
|
||||
public void clear(int mask) {
|
||||
glClear(mask);
|
||||
}
|
||||
|
||||
public void clearColor(float red, float green, float blue, float alpha) {
|
||||
glClearColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void clearDepthf(float depth) {
|
||||
glClearDepthf(depth);
|
||||
}
|
||||
|
||||
public void clearStencil(int s) {
|
||||
glClearStencil(s);
|
||||
}
|
||||
|
||||
public void colorMask(boolean red, boolean green, boolean blue, boolean alpha) {
|
||||
glColorMask(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void compressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border,
|
||||
int imageSize, Buffer data) {
|
||||
glCompressedTexImage2D(
|
||||
target,
|
||||
level,
|
||||
internalformat,
|
||||
width,
|
||||
height,
|
||||
border,
|
||||
imageSize,
|
||||
data);
|
||||
}
|
||||
|
||||
public void compressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format,
|
||||
int imageSize, Buffer data) {
|
||||
glCompressedTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
imageSize,
|
||||
data);
|
||||
}
|
||||
|
||||
public void copyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border) {
|
||||
glCopyTexImage2D(target, level, internalformat, x, y, width, height, border);
|
||||
}
|
||||
|
||||
public void copyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height) {
|
||||
glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
public void cullFace(int mode) {
|
||||
glCullFace(mode);
|
||||
}
|
||||
|
||||
public void deleteTextures(int n, IntBuffer textures) {
|
||||
glDeleteTextures(n, textures);
|
||||
}
|
||||
|
||||
public void depthFunc(int func) {
|
||||
glDepthFunc(func);
|
||||
}
|
||||
|
||||
public void depthMask(boolean flag) {
|
||||
glDepthMask(flag);
|
||||
}
|
||||
|
||||
public void depthRangef(float zNear, float zFar) {
|
||||
glDepthRangef(zNear, zFar);
|
||||
}
|
||||
|
||||
public void disable(int cap) {
|
||||
glDisable(cap);
|
||||
}
|
||||
|
||||
public void drawArrays(int mode, int first, int count) {
|
||||
glDrawArrays(mode, first, count);
|
||||
}
|
||||
|
||||
public void drawElements(int mode, int count, int type, Buffer indices) {
|
||||
glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
public void enable(int cap) {
|
||||
glEnable(cap);
|
||||
}
|
||||
|
||||
public void finish() {
|
||||
glFinish();
|
||||
}
|
||||
|
||||
public void flush() {
|
||||
glFlush();
|
||||
}
|
||||
|
||||
public void frontFace(int mode) {
|
||||
glFrontFace(mode);
|
||||
}
|
||||
|
||||
public void genTextures(int n, IntBuffer textures) {
|
||||
glGenTextures(n, textures);
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return glGetError();
|
||||
}
|
||||
|
||||
public void getIntegerv(int pname, IntBuffer params) {
|
||||
glGetIntegerv(pname, params);
|
||||
}
|
||||
|
||||
public String getString(int name) {
|
||||
return glGetString(name);
|
||||
}
|
||||
|
||||
public void hint(int target, int mode) {
|
||||
glHint(target, mode);
|
||||
}
|
||||
|
||||
public void lineWidth(float width) {
|
||||
glLineWidth(width);
|
||||
}
|
||||
|
||||
public void pixelStorei(int pname, int param) {
|
||||
glPixelStorei(pname, param);
|
||||
}
|
||||
|
||||
public void polygonOffset(float factor, float units) {
|
||||
glPolygonOffset(factor, units);
|
||||
}
|
||||
|
||||
public void readPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
glReadPixels(x, y, width, height, format, type, pixels);
|
||||
}
|
||||
|
||||
public void scissor(int x, int y, int width, int height) {
|
||||
glScissor(x, y, width, height);
|
||||
}
|
||||
|
||||
public void stencilFunc(int func, int ref, int mask) {
|
||||
glStencilFunc(func, ref, mask);
|
||||
}
|
||||
|
||||
public void stencilMask(int mask) {
|
||||
glStencilMask(mask);
|
||||
}
|
||||
|
||||
public void stencilOp(int fail, int zfail, int zpass) {
|
||||
glStencilOp(fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void texImage2D(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);
|
||||
}
|
||||
|
||||
public void texParameterf(int target, int pname, float param) {
|
||||
glTexParameterf(target, pname, param);
|
||||
}
|
||||
|
||||
public void texSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type,
|
||||
Buffer pixels) {
|
||||
glTexSubImage2D(target,
|
||||
level,
|
||||
xoffset,
|
||||
yoffset,
|
||||
width,
|
||||
height,
|
||||
format,
|
||||
type,
|
||||
pixels);
|
||||
}
|
||||
|
||||
public void viewport(int x, int y, int width, int height) {
|
||||
glViewport(x, y, width, height);
|
||||
}
|
||||
|
||||
public void getFloatv(int pname, FloatBuffer params) {
|
||||
glGetFloatv(pname, params);
|
||||
}
|
||||
|
||||
public void getTexParameterfv(int target, int pname, FloatBuffer params) {
|
||||
glGetTexParameterfv(target, pname, params);
|
||||
}
|
||||
|
||||
public void texParameterfv(int target, int pname, FloatBuffer params) {
|
||||
glTexParameterfv(target, pname, params);
|
||||
}
|
||||
|
||||
public void bindBuffer(int target, int buffer) {
|
||||
glBindBuffer(target, buffer);
|
||||
}
|
||||
|
||||
public void bufferData(int target, int size, Buffer data, int usage) {
|
||||
glBufferData(target, size, data, usage);
|
||||
}
|
||||
|
||||
public void bufferSubData(int target, int offset, int size, Buffer data) {
|
||||
glBufferSubData(target, offset, size, data);
|
||||
}
|
||||
|
||||
public void deleteBuffers(int n, IntBuffer buffers) {
|
||||
glDeleteBuffers(n, buffers);
|
||||
}
|
||||
|
||||
public void getBufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
glGetBufferParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
public void genBuffers(int n, IntBuffer buffers) {
|
||||
glGenBuffers(n, buffers);
|
||||
}
|
||||
|
||||
public void getTexParameteriv(int target, int pname, IntBuffer params) {
|
||||
glGetTexParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
public boolean isBuffer(int buffer) {
|
||||
return glIsBuffer(buffer);
|
||||
}
|
||||
|
||||
public boolean isEnabled(int cap) {
|
||||
return glIsEnabled(cap);
|
||||
}
|
||||
|
||||
public boolean isTexture(int texture) {
|
||||
return glIsTexture(texture);
|
||||
}
|
||||
|
||||
public void texParameteri(int target, int pname, int param) {
|
||||
glTexParameteri(target, pname, param);
|
||||
}
|
||||
|
||||
public void texParameteriv(int target, int pname, IntBuffer params) {
|
||||
glTexParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
public void drawElements(int mode, int count, int type, int indices) {
|
||||
glDrawElements(mode, count, type, indices);
|
||||
}
|
||||
|
||||
public void attachShader(int program, int shader) {
|
||||
glAttachShader(program, shader);
|
||||
}
|
||||
|
||||
public void bindAttribLocation(int program, int index, String name) {
|
||||
glBindAttribLocation(program, index, name);
|
||||
}
|
||||
|
||||
public void bindFramebuffer(int target, int framebuffer) {
|
||||
glBindFramebuffer(target, framebuffer);
|
||||
}
|
||||
|
||||
public void bindRenderbuffer(int target, int renderbuffer) {
|
||||
glBindRenderbuffer(target, renderbuffer);
|
||||
}
|
||||
|
||||
public void blendColor(float red, float green, float blue, float alpha) {
|
||||
glBlendColor(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void blendEquation(int mode) {
|
||||
glBlendEquation(mode);
|
||||
}
|
||||
|
||||
public void blendEquationSeparate(int modeRGB, int modeAlpha) {
|
||||
glBlendEquationSeparate(modeRGB, modeAlpha);
|
||||
}
|
||||
|
||||
public void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) {
|
||||
glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
|
||||
}
|
||||
|
||||
public int checkFramebufferStatus(int target) {
|
||||
return glCheckFramebufferStatus(target);
|
||||
}
|
||||
|
||||
public void compileShader(int shader) {
|
||||
glCompileShader(shader);
|
||||
}
|
||||
|
||||
public int createProgram() {
|
||||
return glCreateProgram();
|
||||
}
|
||||
|
||||
public int createShader(int type) {
|
||||
return glCreateShader(type);
|
||||
}
|
||||
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers) {
|
||||
glDeleteFramebuffers(n, framebuffers);
|
||||
}
|
||||
|
||||
public void deleteProgram(int program) {
|
||||
glDeleteProgram(program);
|
||||
}
|
||||
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
glDeleteRenderbuffers(n, renderbuffers);
|
||||
}
|
||||
|
||||
public void deleteShader(int shader) {
|
||||
glDeleteShader(shader);
|
||||
}
|
||||
|
||||
public void detachShader(int program, int shader) {
|
||||
glDetachShader(program, shader);
|
||||
}
|
||||
|
||||
public void disableVertexAttribArray(int index) {
|
||||
glDisableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void enableVertexAttribArray(int index) {
|
||||
glEnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer) {
|
||||
glFramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
|
||||
}
|
||||
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level) {
|
||||
glFramebufferTexture2D(target, attachment, textarget, texture, level);
|
||||
}
|
||||
|
||||
public void generateMipmap(int target) {
|
||||
glGenerateMipmap(target);
|
||||
}
|
||||
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers) {
|
||||
glGenFramebuffers(n, framebuffers);
|
||||
}
|
||||
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers) {
|
||||
glGenRenderbuffers(n, renderbuffers);
|
||||
}
|
||||
|
||||
public String getActiveAttrib(int program, int index, IntBuffer size, Buffer type) {
|
||||
return glGetActiveAttrib(program,
|
||||
index,
|
||||
size,
|
||||
type);
|
||||
}
|
||||
|
||||
public String getActiveUniform(int program, int index, IntBuffer size, Buffer type) {
|
||||
return glGetActiveUniform(program,
|
||||
index,
|
||||
size,
|
||||
type);
|
||||
}
|
||||
|
||||
public void getAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders) {
|
||||
glGetAttachedShaders(program,
|
||||
maxcount,
|
||||
count,
|
||||
shaders);
|
||||
}
|
||||
|
||||
public int getAttribLocation(int program, String name) {
|
||||
return glGetAttribLocation(program, name);
|
||||
}
|
||||
|
||||
public void getBooleanv(int pname, Buffer params) {
|
||||
glGetBooleanv(pname, params);
|
||||
}
|
||||
|
||||
public void getFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params) {
|
||||
glGetFramebufferAttachmentParameteriv(target,
|
||||
attachment,
|
||||
pname,
|
||||
params);
|
||||
}
|
||||
|
||||
public void getProgramiv(int program, int pname, IntBuffer params) {
|
||||
glGetProgramiv(program, pname, params);
|
||||
}
|
||||
|
||||
public String getProgramInfoLog(int program) {
|
||||
return glGetProgramInfoLog(program);
|
||||
}
|
||||
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params) {
|
||||
glGetRenderbufferParameteriv(target, pname, params);
|
||||
}
|
||||
|
||||
public void getShaderiv(int shader, int pname, IntBuffer params) {
|
||||
glGetShaderiv(shader, pname, params);
|
||||
}
|
||||
|
||||
public String getShaderInfoLog(int shader) {
|
||||
return glGetShaderInfoLog(shader);
|
||||
}
|
||||
|
||||
public void getShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision) {
|
||||
glGetShaderPrecisionFormat(shadertype,
|
||||
precisiontype,
|
||||
range,
|
||||
precision);
|
||||
}
|
||||
|
||||
public void getShaderSource(int shader, int bufsize, Buffer length, String source) {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
|
||||
public void getUniformfv(int program, int location, FloatBuffer params) {
|
||||
glGetUniformfv(program, location, params);
|
||||
}
|
||||
|
||||
public void getUniformiv(int program, int location, IntBuffer params) {
|
||||
glGetUniformiv(program, location, params);
|
||||
}
|
||||
|
||||
public int getUniformLocation(int program, String name) {
|
||||
return glGetUniformLocation(program, name);
|
||||
}
|
||||
|
||||
public void getVertexAttribfv(int index, int pname, FloatBuffer params) {
|
||||
glGetVertexAttribfv(index, pname, params);
|
||||
}
|
||||
|
||||
public void getVertexAttribiv(int index, int pname, IntBuffer params) {
|
||||
glGetVertexAttribiv(index, pname, params);
|
||||
}
|
||||
|
||||
public void getVertexAttribPointerv(int index, int pname, Buffer pointer) {
|
||||
glGetVertexAttribPointerv(index, pname, pointer);
|
||||
}
|
||||
|
||||
public boolean isFramebuffer(int framebuffer) {
|
||||
return glIsFramebuffer(framebuffer);
|
||||
}
|
||||
|
||||
public boolean isProgram(int program) {
|
||||
return glIsProgram(program);
|
||||
}
|
||||
|
||||
public boolean isRenderbuffer(int renderbuffer) {
|
||||
return glIsRenderbuffer(renderbuffer);
|
||||
}
|
||||
|
||||
public boolean isShader(int shader) {
|
||||
return glIsShader(shader);
|
||||
}
|
||||
|
||||
public void linkProgram(int program) {
|
||||
glLinkProgram(program);
|
||||
}
|
||||
|
||||
public void releaseShaderCompiler() {
|
||||
glReleaseShaderCompiler();
|
||||
}
|
||||
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height) {
|
||||
glRenderbufferStorage(target, internalformat, width, height);
|
||||
}
|
||||
|
||||
public void sampleCoverage(float value, boolean invert) {
|
||||
glSampleCoverage(value, invert);
|
||||
}
|
||||
|
||||
public void shaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length) {
|
||||
glShaderBinary(n,
|
||||
shaders,
|
||||
binaryformat,
|
||||
binary,
|
||||
length);
|
||||
}
|
||||
|
||||
public void shaderSource(int shader, String string) {
|
||||
glShaderSource(shader, string);
|
||||
}
|
||||
|
||||
public void stencilFuncSeparate(int face, int func, int ref, int mask) {
|
||||
glStencilFuncSeparate(face, func, ref, mask);
|
||||
}
|
||||
|
||||
public void stencilMaskSeparate(int face, int mask) {
|
||||
glStencilMaskSeparate(face, mask);
|
||||
}
|
||||
|
||||
public void stencilOpSeparate(int face, int fail, int zfail, int zpass) {
|
||||
glStencilOpSeparate(face, fail, zfail, zpass);
|
||||
}
|
||||
|
||||
public void uniform1f(int location, float x) {
|
||||
glUniform1f(location, x);
|
||||
}
|
||||
|
||||
public void uniform1fv(int location, int count, FloatBuffer v) {
|
||||
glUniform1fv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform1i(int location, int x) {
|
||||
glUniform1i(location, x);
|
||||
}
|
||||
|
||||
public void uniform1iv(int location, int count, IntBuffer v) {
|
||||
glUniform1iv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform2f(int location, float x, float y) {
|
||||
glUniform2f(location, x, y);
|
||||
}
|
||||
|
||||
public void uniform2fv(int location, int count, FloatBuffer v) {
|
||||
glUniform2fv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform2i(int location, int x, int y) {
|
||||
glUniform2i(location, x, y);
|
||||
}
|
||||
|
||||
public void uniform2iv(int location, int count, IntBuffer v) {
|
||||
glUniform2iv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform3f(int location, float x, float y, float z) {
|
||||
glUniform3f(location, x, y, z);
|
||||
}
|
||||
|
||||
public void uniform3fv(int location, int count, FloatBuffer v) {
|
||||
glUniform3fv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform3i(int location, int x, int y, int z) {
|
||||
glUniform3i(location, x, y, z);
|
||||
}
|
||||
|
||||
public void uniform3iv(int location, int count, IntBuffer v) {
|
||||
glUniform3iv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform4f(int location, float x, float y, float z, float w) {
|
||||
glUniform4f(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void uniform4fv(int location, int count, FloatBuffer v) {
|
||||
glUniform4fv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniform4i(int location, int x, int y, int z, int w) {
|
||||
glUniform4i(location, x, y, z, w);
|
||||
}
|
||||
|
||||
public void uniform4iv(int location, int count, IntBuffer v) {
|
||||
glUniform4iv(location, count, v);
|
||||
}
|
||||
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
glUniformMatrix2fv(location, count, transpose, value);
|
||||
}
|
||||
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
glUniformMatrix3fv(location, count, transpose, value);
|
||||
}
|
||||
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value) {
|
||||
glUniformMatrix4fv(location, count, transpose, value);
|
||||
}
|
||||
|
||||
public void useProgram(int program) {
|
||||
glUseProgram(program);
|
||||
}
|
||||
|
||||
public void validateProgram(int program) {
|
||||
glValidateProgram(program);
|
||||
}
|
||||
|
||||
public void vertexAttrib1f(int indx, float x) {
|
||||
glVertexAttrib1f(indx, x);
|
||||
}
|
||||
|
||||
public void vertexAttrib1fv(int indx, FloatBuffer values) {
|
||||
glVertexAttrib1fv(indx, values);
|
||||
}
|
||||
|
||||
public void vertexAttrib2f(int indx, float x, float y) {
|
||||
glVertexAttrib2f(indx, x, y);
|
||||
}
|
||||
|
||||
public void vertexAttrib2fv(int indx, FloatBuffer values) {
|
||||
glVertexAttrib2fv(indx, values);
|
||||
}
|
||||
|
||||
public void vertexAttrib3f(int indx, float x, float y, float z) {
|
||||
glVertexAttrib3f(indx, x, y, z);
|
||||
}
|
||||
|
||||
public void vertexAttrib3fv(int indx, FloatBuffer values) {
|
||||
glVertexAttrib3fv(indx, values);
|
||||
}
|
||||
|
||||
public void vertexAttrib4f(int indx, float x, float y, float z, float w) {
|
||||
glVertexAttrib4f(indx, x, y, z, w);
|
||||
}
|
||||
|
||||
public void vertexAttrib4fv(int indx, FloatBuffer values) {
|
||||
glVertexAttrib4fv(indx, values);
|
||||
}
|
||||
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer ptr) {
|
||||
glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int ptr) {
|
||||
glVertexAttribPointer(indx, size, type, normalized, stride, ptr);
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.oscim.gdx.client;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
@ -79,7 +79,7 @@ public class GwtBitmap implements Bitmap {
|
||||
@Override
|
||||
public void uploadToTexture(boolean replace) {
|
||||
|
||||
Gdx.gl.glTexImage2D(GL20.GL_TEXTURE_2D, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(),
|
||||
Gdx.gl.glTexImage2D(GL.TEXTURE_2D, 0, pixmap.getGLInternalFormat(), pixmap.getWidth(),
|
||||
pixmap.getHeight(), 0,
|
||||
pixmap.getGLFormat(), pixmap.getGLType(), pixmap.getPixels());
|
||||
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
package org.oscim.gdx.client;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
|
||||
import com.badlogic.gdx.backends.gwt.GwtGL20;
|
||||
import com.badlogic.gdx.graphics.Pixmap;
|
||||
import com.google.gwt.typedarrays.client.Uint8ArrayNative;
|
||||
import com.google.gwt.webgl.client.WebGLRenderingContext;
|
||||
|
||||
public class GwtGLAdapter extends GwtGL20 implements GL20 {
|
||||
|
||||
protected final WebGLRenderingContext gl;
|
||||
|
||||
public GwtGLAdapter(WebGLRenderingContext gl) {
|
||||
super(gl);
|
||||
gl.pixelStorei(WebGLRenderingContext.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
|
||||
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) {
|
||||
|
||||
if (pixels == null) {
|
||||
gl.texImage2D(target, level, internalformat,
|
||||
width, height, border, format,
|
||||
type, null);
|
||||
return;
|
||||
}
|
||||
|
||||
Pixmap pixmap = Pixmap.pixmaps.get(((IntBuffer) pixels).get(0));
|
||||
if (pixmap != null) {
|
||||
gl.texImage2D(target, level, internalformat, format, type, pixmap.getCanvasElement());
|
||||
} else if (format == GL20.GL_ALPHA) {
|
||||
int tmp[] = new int[(width * height) >> 2];
|
||||
((IntBuffer) pixels).get(tmp);
|
||||
|
||||
Uint8ArrayNative v = com.google.gwt.typedarrays.client.Uint8ArrayNative.create(width
|
||||
* height);
|
||||
|
||||
for (int i = 0, n = (width * height) >> 2; i < n; i++) {
|
||||
v.set(i * 4 + 3, (tmp[i] >> 24) & 0xff);
|
||||
v.set(i * 4 + 2, (tmp[i] >> 16) & 0xff);
|
||||
v.set(i * 4 + 1, (tmp[i] >> 8) & 0xff);
|
||||
v.set(i * 4 + 0, (tmp[i]) & 0xff);
|
||||
}
|
||||
gl.texImage2D(target, level, internalformat, width, height, 0, format, type, v);
|
||||
}
|
||||
}
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
|
||||
package com.badlogic.gdx.backends.gwt;
|
||||
|
||||
import org.oscim.gdx.client.GwtGLAdapter;
|
||||
import org.oscim.gdx.client.GdxGL;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -91,7 +91,7 @@ public class GwtGraphics implements Graphics {
|
||||
log.error("Missing gl extension for WEBKIT_WEBGL_depth_texture");
|
||||
}
|
||||
|
||||
this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GwtGLAdapter(context);
|
||||
this.gl = config.useDebugGL ? new GwtGL20Debug(context) : new GdxGL(context);
|
||||
}
|
||||
|
||||
public static native double getDevicePixelRatioJSNI() /*-{
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
@ -295,7 +297,7 @@ public class GLMatrix {
|
||||
buffer.clear();
|
||||
buffer.put(val, 0, 16);
|
||||
buffer.position(0);
|
||||
MapRenderer.GL.glUniformMatrix4fv(location, 1, false, buffer);
|
||||
gl.uniformMatrix4fv(location, 1, false, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
672
vtm/src/org/oscim/backend/GL.java
Normal file
672
vtm/src/org/oscim/backend/GL.java
Normal file
@ -0,0 +1,672 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
*
|
||||
* 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 libgdx AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
package org.oscim.backend;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/**
|
||||
* Interface wrapping all the methods of OpenGL ES 2.0
|
||||
*
|
||||
* @author mzechner
|
||||
*/
|
||||
public interface GL {
|
||||
public static final int ES_VERSION_2_0 = 1;
|
||||
public static final int DEPTH_BUFFER_BIT = 0x00000100;
|
||||
public static final int STENCIL_BUFFER_BIT = 0x00000400;
|
||||
public static final int COLOR_BUFFER_BIT = 0x00004000;
|
||||
public static final int FALSE = 0;
|
||||
public static final int TRUE = 1;
|
||||
public static final int POINTS = 0x0000;
|
||||
public static final int LINES = 0x0001;
|
||||
public static final int LINE_LOOP = 0x0002;
|
||||
public static final int LINE_STRIP = 0x0003;
|
||||
public static final int TRIANGLES = 0x0004;
|
||||
public static final int TRIANGLE_STRIP = 0x0005;
|
||||
public static final int TRIANGLE_FAN = 0x0006;
|
||||
public static final int ZERO = 0;
|
||||
public static final int ONE = 1;
|
||||
public static final int SRC_COLOR = 0x0300;
|
||||
public static final int ONE_MINUS_SRC_COLOR = 0x0301;
|
||||
public static final int SRC_ALPHA = 0x0302;
|
||||
public static final int ONE_MINUS_SRC_ALPHA = 0x0303;
|
||||
public static final int DST_ALPHA = 0x0304;
|
||||
public static final int ONE_MINUS_DST_ALPHA = 0x0305;
|
||||
public static final int DST_COLOR = 0x0306;
|
||||
public static final int ONE_MINUS_DST_COLOR = 0x0307;
|
||||
public static final int SRC_ALPHA_SATURATE = 0x0308;
|
||||
public static final int FUNC_ADD = 0x8006;
|
||||
public static final int BLEND_EQUATION = 0x8009;
|
||||
public static final int BLEND_EQUATION_RGB = 0x8009;
|
||||
public static final int BLEND_EQUATION_ALPHA = 0x883D;
|
||||
public static final int FUNC_SUBTRACT = 0x800A;
|
||||
public static final int FUNC_REVERSE_SUBTRACT = 0x800B;
|
||||
public static final int BLEND_DST_RGB = 0x80C8;
|
||||
public static final int BLEND_SRC_RGB = 0x80C9;
|
||||
public static final int BLEND_DST_ALPHA = 0x80CA;
|
||||
public static final int BLEND_SRC_ALPHA = 0x80CB;
|
||||
public static final int CONSTANT_COLOR = 0x8001;
|
||||
public static final int ONE_MINUS_CONSTANT_COLOR = 0x8002;
|
||||
public static final int CONSTANT_ALPHA = 0x8003;
|
||||
public static final int ONE_MINUS_CONSTANT_ALPHA = 0x8004;
|
||||
public static final int BLEND_COLOR = 0x8005;
|
||||
public static final int ARRAY_BUFFER = 0x8892;
|
||||
public static final int ELEMENT_ARRAY_BUFFER = 0x8893;
|
||||
public static final int ARRAY_BUFFER_BINDING = 0x8894;
|
||||
public static final int ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
|
||||
public static final int STREAM_DRAW = 0x88E0;
|
||||
public static final int STATIC_DRAW = 0x88E4;
|
||||
public static final int DYNAMIC_DRAW = 0x88E8;
|
||||
public static final int BUFFER_SIZE = 0x8764;
|
||||
public static final int BUFFER_USAGE = 0x8765;
|
||||
public static final int CURRENT_VERTEX_ATTRIB = 0x8626;
|
||||
public static final int FRONT = 0x0404;
|
||||
public static final int BACK = 0x0405;
|
||||
public static final int FRONT_AND_BACK = 0x0408;
|
||||
public static final int TEXTURE_2D = 0x0DE1;
|
||||
public static final int CULL_FACE = 0x0B44;
|
||||
public static final int BLEND = 0x0BE2;
|
||||
public static final int DITHER = 0x0BD0;
|
||||
public static final int STENCIL_TEST = 0x0B90;
|
||||
public static final int DEPTH_TEST = 0x0B71;
|
||||
public static final int SCISSOR_TEST = 0x0C11;
|
||||
public static final int POLYGON_OFFSET_FILL = 0x8037;
|
||||
public static final int SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
|
||||
public static final int SAMPLE_COVERAGE = 0x80A0;
|
||||
//public static final int NO_ERROR = 0;
|
||||
public static final int INVALID_ENUM = 0x0500;
|
||||
public static final int INVALID_VALUE = 0x0501;
|
||||
public static final int INVALID_OPERATION = 0x0502;
|
||||
public static final int OUT_OF_MEMORY = 0x0505;
|
||||
public static final int CW = 0x0900;
|
||||
public static final int CCW = 0x0901;
|
||||
public static final int LINE_WIDTH = 0x0B21;
|
||||
public static final int ALIASED_POINT_SIZE_RANGE = 0x846D;
|
||||
public static final int ALIASED_LINE_WIDTH_RANGE = 0x846E;
|
||||
public static final int CULL_FACE_MODE = 0x0B45;
|
||||
public static final int FRONT_FACE = 0x0B46;
|
||||
public static final int DEPTH_RANGE = 0x0B70;
|
||||
public static final int DEPTH_WRITEMASK = 0x0B72;
|
||||
public static final int DEPTH_CLEAR_VALUE = 0x0B73;
|
||||
public static final int DEPTH_FUNC = 0x0B74;
|
||||
public static final int STENCIL_CLEAR_VALUE = 0x0B91;
|
||||
public static final int STENCIL_FUNC = 0x0B92;
|
||||
public static final int STENCIL_FAIL = 0x0B94;
|
||||
public static final int STENCIL_PASS_DEPTH_FAIL = 0x0B95;
|
||||
public static final int STENCIL_PASS_DEPTH_PASS = 0x0B96;
|
||||
public static final int STENCIL_REF = 0x0B97;
|
||||
public static final int STENCIL_VALUE_MASK = 0x0B93;
|
||||
public static final int STENCIL_WRITEMASK = 0x0B98;
|
||||
public static final int STENCIL_BACK_FUNC = 0x8800;
|
||||
public static final int STENCIL_BACK_FAIL = 0x8801;
|
||||
public static final int STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
|
||||
public static final int STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
|
||||
public static final int STENCIL_BACK_REF = 0x8CA3;
|
||||
public static final int STENCIL_BACK_VALUE_MASK = 0x8CA4;
|
||||
public static final int STENCIL_BACK_WRITEMASK = 0x8CA5;
|
||||
public static final int VIEWPORT = 0x0BA2;
|
||||
public static final int SCISSOR_BOX = 0x0C10;
|
||||
public static final int COLOR_CLEAR_VALUE = 0x0C22;
|
||||
public static final int COLOR_WRITEMASK = 0x0C23;
|
||||
public static final int UNPACK_ALIGNMENT = 0x0CF5;
|
||||
public static final int PACK_ALIGNMENT = 0x0D05;
|
||||
public static final int MAX_TEXTURE_SIZE = 0x0D33;
|
||||
public static final int MAX_TEXTURE_UNITS = 0x84E2;
|
||||
public static final int MAX_VIEWPORT_DIMS = 0x0D3A;
|
||||
public static final int SUBPIXEL_BITS = 0x0D50;
|
||||
public static final int RED_BITS = 0x0D52;
|
||||
public static final int GREEN_BITS = 0x0D53;
|
||||
public static final int BLUE_BITS = 0x0D54;
|
||||
public static final int ALPHA_BITS = 0x0D55;
|
||||
public static final int DEPTH_BITS = 0x0D56;
|
||||
public static final int STENCIL_BITS = 0x0D57;
|
||||
public static final int POLYGON_OFFSET_UNITS = 0x2A00;
|
||||
public static final int POLYGON_OFFSET_FACTOR = 0x8038;
|
||||
public static final int TEXTURE_BINDING_2D = 0x8069;
|
||||
public static final int SAMPLE_BUFFERS = 0x80A8;
|
||||
public static final int SAMPLES = 0x80A9;
|
||||
public static final int SAMPLE_COVERAGE_VALUE = 0x80AA;
|
||||
public static final int SAMPLE_COVERAGE_INVERT = 0x80AB;
|
||||
public static final int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
|
||||
public static final int COMPRESSED_TEXTURE_FORMATS = 0x86A3;
|
||||
public static final int DONT_CARE = 0x1100;
|
||||
public static final int FASTEST = 0x1101;
|
||||
public static final int NICEST = 0x1102;
|
||||
public static final int GENERATE_MIPMAP_HINT = 0x8192;
|
||||
public static final int BYTE = 0x1400;
|
||||
public static final int UNSIGNED_BYTE = 0x1401;
|
||||
public static final int SHORT = 0x1402;
|
||||
public static final int UNSIGNED_SHORT = 0x1403;
|
||||
public static final int INT = 0x1404;
|
||||
public static final int UNSIGNED_INT = 0x1405;
|
||||
public static final int FLOAT = 0x1406;
|
||||
public static final int FIXED = 0x140C;
|
||||
public static final int DEPTH_COMPONENT = 0x1902;
|
||||
public static final int ALPHA = 0x1906;
|
||||
public static final int RGB = 0x1907;
|
||||
public static final int RGBA = 0x1908;
|
||||
public static final int LUMINANCE = 0x1909;
|
||||
public static final int LUMINANCE_ALPHA = 0x190A;
|
||||
public static final int UNSIGNED_SHORT_4_4_4_4 = 0x8033;
|
||||
public static final int UNSIGNED_SHORT_5_5_5_1 = 0x8034;
|
||||
public static final int UNSIGNED_SHORT_5_6_5 = 0x8363;
|
||||
public static final int FRAGMENT_SHADER = 0x8B30;
|
||||
public static final int VERTEX_SHADER = 0x8B31;
|
||||
public static final int MAX_VERTEX_ATTRIBS = 0x8869;
|
||||
public static final int MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
|
||||
public static final int MAX_VARYING_VECTORS = 0x8DFC;
|
||||
public static final int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
|
||||
public static final int MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
|
||||
public static final int MAX_TEXTURE_IMAGE_UNITS = 0x8872;
|
||||
public static final int MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
|
||||
public static final int SHADER_TYPE = 0x8B4F;
|
||||
public static final int DELETE_STATUS = 0x8B80;
|
||||
public static final int LINK_STATUS = 0x8B82;
|
||||
public static final int VALIDATE_STATUS = 0x8B83;
|
||||
public static final int ATTACHED_SHADERS = 0x8B85;
|
||||
public static final int ACTIVE_UNIFORMS = 0x8B86;
|
||||
public static final int ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87;
|
||||
public static final int ACTIVE_ATTRIBUTES = 0x8B89;
|
||||
public static final int ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A;
|
||||
public static final int SHADING_LANGUAGE_VERSION = 0x8B8C;
|
||||
public static final int CURRENT_PROGRAM = 0x8B8D;
|
||||
public static final int NEVER = 0x0200;
|
||||
public static final int LESS = 0x0201;
|
||||
public static final int EQUAL = 0x0202;
|
||||
public static final int LEQUAL = 0x0203;
|
||||
public static final int GREATER = 0x0204;
|
||||
public static final int NOTEQUAL = 0x0205;
|
||||
public static final int GEQUAL = 0x0206;
|
||||
public static final int ALWAYS = 0x0207;
|
||||
public static final int KEEP = 0x1E00;
|
||||
public static final int REPLACE = 0x1E01;
|
||||
public static final int INCR = 0x1E02;
|
||||
public static final int DECR = 0x1E03;
|
||||
public static final int INVERT = 0x150A;
|
||||
public static final int INCR_WRAP = 0x8507;
|
||||
public static final int DECR_WRAP = 0x8508;
|
||||
public static final int VENDOR = 0x1F00;
|
||||
public static final int RENDERER = 0x1F01;
|
||||
public static final int VERSION = 0x1F02;
|
||||
public static final int EXTENSIONS = 0x1F03;
|
||||
public static final int NEAREST = 0x2600;
|
||||
public static final int LINEAR = 0x2601;
|
||||
public static final int NEAREST_MIPMAP_NEAREST = 0x2700;
|
||||
public static final int LINEAR_MIPMAP_NEAREST = 0x2701;
|
||||
public static final int NEAREST_MIPMAP_LINEAR = 0x2702;
|
||||
public static final int LINEAR_MIPMAP_LINEAR = 0x2703;
|
||||
public static final int TEXTURE_MAG_FILTER = 0x2800;
|
||||
public static final int TEXTURE_MIN_FILTER = 0x2801;
|
||||
public static final int TEXTURE_WRAP_S = 0x2802;
|
||||
public static final int TEXTURE_WRAP_T = 0x2803;
|
||||
public static final int TEXTURE = 0x1702;
|
||||
public static final int TEXTURE_CUBE_MAP = 0x8513;
|
||||
public static final int TEXTURE_BINDING_CUBE_MAP = 0x8514;
|
||||
public static final int TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
|
||||
public static final int TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
|
||||
public static final int TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
|
||||
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
|
||||
public static final int TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
|
||||
public static final int TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
|
||||
public static final int MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
|
||||
public static final int TEXTURE0 = 0x84C0;
|
||||
public static final int TEXTURE1 = 0x84C1;
|
||||
public static final int TEXTURE2 = 0x84C2;
|
||||
public static final int TEXTURE3 = 0x84C3;
|
||||
public static final int TEXTURE4 = 0x84C4;
|
||||
public static final int TEXTURE5 = 0x84C5;
|
||||
public static final int TEXTURE6 = 0x84C6;
|
||||
public static final int TEXTURE7 = 0x84C7;
|
||||
public static final int TEXTURE8 = 0x84C8;
|
||||
public static final int TEXTURE9 = 0x84C9;
|
||||
public static final int TEXTURE10 = 0x84CA;
|
||||
public static final int TEXTURE11 = 0x84CB;
|
||||
public static final int TEXTURE12 = 0x84CC;
|
||||
public static final int TEXTURE13 = 0x84CD;
|
||||
public static final int TEXTURE14 = 0x84CE;
|
||||
public static final int TEXTURE15 = 0x84CF;
|
||||
public static final int TEXTURE16 = 0x84D0;
|
||||
public static final int TEXTURE17 = 0x84D1;
|
||||
public static final int TEXTURE18 = 0x84D2;
|
||||
public static final int TEXTURE19 = 0x84D3;
|
||||
public static final int TEXTURE20 = 0x84D4;
|
||||
public static final int TEXTURE21 = 0x84D5;
|
||||
public static final int TEXTURE22 = 0x84D6;
|
||||
public static final int TEXTURE23 = 0x84D7;
|
||||
public static final int TEXTURE24 = 0x84D8;
|
||||
public static final int TEXTURE25 = 0x84D9;
|
||||
public static final int TEXTURE26 = 0x84DA;
|
||||
public static final int TEXTURE27 = 0x84DB;
|
||||
public static final int TEXTURE28 = 0x84DC;
|
||||
public static final int TEXTURE29 = 0x84DD;
|
||||
public static final int TEXTURE30 = 0x84DE;
|
||||
public static final int TEXTURE31 = 0x84DF;
|
||||
public static final int ACTIVE_TEXTURE = 0x84E0;
|
||||
public static final int REPEAT = 0x2901;
|
||||
public static final int CLAMP_TO_EDGE = 0x812F;
|
||||
public static final int MIRRORED_REPEAT = 0x8370;
|
||||
public static final int FLOAT_VEC2 = 0x8B50;
|
||||
public static final int FLOAT_VEC3 = 0x8B51;
|
||||
public static final int FLOAT_VEC4 = 0x8B52;
|
||||
public static final int INT_VEC2 = 0x8B53;
|
||||
public static final int INT_VEC3 = 0x8B54;
|
||||
public static final int INT_VEC4 = 0x8B55;
|
||||
public static final int BOOL = 0x8B56;
|
||||
public static final int BOOL_VEC2 = 0x8B57;
|
||||
public static final int BOOL_VEC3 = 0x8B58;
|
||||
public static final int BOOL_VEC4 = 0x8B59;
|
||||
public static final int FLOAT_MAT2 = 0x8B5A;
|
||||
public static final int FLOAT_MAT3 = 0x8B5B;
|
||||
public static final int FLOAT_MAT4 = 0x8B5C;
|
||||
public static final int SAMPLER_2D = 0x8B5E;
|
||||
public static final int SAMPLER_CUBE = 0x8B60;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
|
||||
public static final int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
|
||||
public static final int IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
|
||||
public static final int IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
|
||||
public static final int COMPILE_STATUS = 0x8B81;
|
||||
public static final int INFO_LOG_LENGTH = 0x8B84;
|
||||
public static final int SHADER_SOURCE_LENGTH = 0x8B88;
|
||||
public static final int SHADER_COMPILER = 0x8DFA;
|
||||
public static final int SHADER_BINARY_FORMATS = 0x8DF8;
|
||||
public static final int NUM_SHADER_BINARY_FORMATS = 0x8DF9;
|
||||
public static final int LOW_FLOAT = 0x8DF0;
|
||||
public static final int MEDIUM_FLOAT = 0x8DF1;
|
||||
public static final int HIGH_FLOAT = 0x8DF2;
|
||||
public static final int LOW_INT = 0x8DF3;
|
||||
public static final int MEDIUM_INT = 0x8DF4;
|
||||
public static final int HIGH_INT = 0x8DF5;
|
||||
public static final int FRAMEBUFFER = 0x8D40;
|
||||
public static final int RENDERBUFFER = 0x8D41;
|
||||
public static final int RGBA4 = 0x8056;
|
||||
public static final int RGB5_A1 = 0x8057;
|
||||
public static final int RGB565 = 0x8D62;
|
||||
public static final int DEPTH_COMPONENT16 = 0x81A5;
|
||||
public static final int STENCIL_INDEX = 0x1901;
|
||||
public static final int STENCIL_INDEX8 = 0x8D48;
|
||||
public static final int RENDERBUFFER_WIDTH = 0x8D42;
|
||||
public static final int RENDERBUFFER_HEIGHT = 0x8D43;
|
||||
public static final int RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
|
||||
public static final int RENDERBUFFER_RED_SIZE = 0x8D50;
|
||||
public static final int RENDERBUFFER_GREEN_SIZE = 0x8D51;
|
||||
public static final int RENDERBUFFER_BLUE_SIZE = 0x8D52;
|
||||
public static final int RENDERBUFFER_ALPHA_SIZE = 0x8D53;
|
||||
public static final int RENDERBUFFER_DEPTH_SIZE = 0x8D54;
|
||||
public static final int RENDERBUFFER_STENCIL_SIZE = 0x8D55;
|
||||
public static final int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
|
||||
public static final int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
|
||||
public static final int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
|
||||
public static final int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
|
||||
public static final int COLOR_ATTACHMENT0 = 0x8CE0;
|
||||
public static final int DEPTH_ATTACHMENT = 0x8D00;
|
||||
public static final int STENCIL_ATTACHMENT = 0x8D20;
|
||||
public static final int NONE = 0;
|
||||
public static final int FRAMEBUFFER_COMPLETE = 0x8CD5;
|
||||
public static final int FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
|
||||
public static final int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
|
||||
public static final int FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
|
||||
public static final int FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
|
||||
public static final int FRAMEBUFFER_BINDING = 0x8CA6;
|
||||
public static final int RENDERBUFFER_BINDING = 0x8CA7;
|
||||
public static final int MAX_RENDERBUFFER_SIZE = 0x84E8;
|
||||
public static final int INVALID_FRAMEBUFFER_OPERATION = 0x0506;
|
||||
public static final int VERTEX_PROGRAM_POINT_SIZE = 0x8642;
|
||||
|
||||
// Extensions
|
||||
public static final int COVERAGE_BUFFER_BIT_NV = 0x8000;
|
||||
|
||||
public void attachShader(int program, int shader);
|
||||
|
||||
public void bindAttribLocation(int program, int index, String name);
|
||||
|
||||
public void bindBuffer(int target, int buffer);
|
||||
|
||||
public void bindFramebuffer(int target, int framebuffer);
|
||||
|
||||
public void bindRenderbuffer(int target, int renderbuffer);
|
||||
|
||||
public void blendColor(float red, float green, float blue, float alpha);
|
||||
|
||||
public void blendEquation(int mode);
|
||||
|
||||
public void blendEquationSeparate(int modeRGB, int modeAlpha);
|
||||
|
||||
public void blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
|
||||
|
||||
public void bufferData(int target, int size, Buffer data, int usage);
|
||||
|
||||
public void bufferSubData(int target, int offset, int size, Buffer data);
|
||||
|
||||
public int checkFramebufferStatus(int target);
|
||||
|
||||
public void compileShader(int shader);
|
||||
|
||||
public int createProgram();
|
||||
|
||||
public int createShader(int type);
|
||||
|
||||
public void deleteBuffers(int n, IntBuffer buffers);
|
||||
|
||||
public void deleteFramebuffers(int n, IntBuffer framebuffers);
|
||||
|
||||
public void deleteProgram(int program);
|
||||
|
||||
public void deleteRenderbuffers(int n, IntBuffer renderbuffers);
|
||||
|
||||
public void deleteShader(int shader);
|
||||
|
||||
public void detachShader(int program, int shader);
|
||||
|
||||
public void disableVertexAttribArray(int index);
|
||||
|
||||
public void drawElements(int mode, int count, int type, int offset);
|
||||
|
||||
public void enableVertexAttribArray(int index);
|
||||
|
||||
public void framebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer);
|
||||
|
||||
public void framebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level);
|
||||
|
||||
public void genBuffers(int n, IntBuffer buffers);
|
||||
|
||||
public void generateMipmap(int target);
|
||||
|
||||
public void genFramebuffers(int n, IntBuffer framebuffers);
|
||||
|
||||
public void genRenderbuffers(int n, IntBuffer renderbuffers);
|
||||
|
||||
// deviates
|
||||
public String getActiveAttrib(int program, int index, IntBuffer size, Buffer type);
|
||||
|
||||
// deviates
|
||||
public String getActiveUniform(int program, int index, IntBuffer size, Buffer type);
|
||||
|
||||
public void getAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders);
|
||||
|
||||
public int getAttribLocation(int program, String name);
|
||||
|
||||
public void getBooleanv(int pname, Buffer params);
|
||||
|
||||
public void getBufferParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void getFloatv(int pname, FloatBuffer params);
|
||||
|
||||
public void getFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params);
|
||||
|
||||
public void getProgramiv(int program, int pname, IntBuffer params);
|
||||
|
||||
// deviates
|
||||
public String getProgramInfoLog(int program);
|
||||
|
||||
public void getRenderbufferParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void getShaderiv(int shader, int pname, IntBuffer params);
|
||||
|
||||
// deviates
|
||||
public String getShaderInfoLog(int shader);
|
||||
|
||||
public void getShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision);
|
||||
|
||||
public void getShaderSource(int shader, int bufsize, Buffer length, String source);
|
||||
|
||||
public void getTexParameterfv(int target, int pname, FloatBuffer params);
|
||||
|
||||
public void getTexParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void getUniformfv(int program, int location, FloatBuffer params);
|
||||
|
||||
public void getUniformiv(int program, int location, IntBuffer params);
|
||||
|
||||
public int getUniformLocation(int program, String name);
|
||||
|
||||
public void getVertexAttribfv(int index, int pname, FloatBuffer params);
|
||||
|
||||
public void getVertexAttribiv(int index, int pname, IntBuffer params);
|
||||
|
||||
public void getVertexAttribPointerv(int index, int pname, Buffer pointer);
|
||||
|
||||
public boolean isBuffer(int buffer);
|
||||
|
||||
public boolean isEnabled(int cap);
|
||||
|
||||
public boolean isFramebuffer(int framebuffer);
|
||||
|
||||
public boolean isProgram(int program);
|
||||
|
||||
public boolean isRenderbuffer(int renderbuffer);
|
||||
|
||||
public boolean isShader(int shader);
|
||||
|
||||
public boolean isTexture(int texture);
|
||||
|
||||
public void linkProgram(int program);
|
||||
|
||||
public void releaseShaderCompiler();
|
||||
|
||||
public void renderbufferStorage(int target, int internalformat, int width, int height);
|
||||
|
||||
public void sampleCoverage(float value, boolean invert);
|
||||
|
||||
public void shaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);
|
||||
|
||||
// Deviates
|
||||
public void shaderSource(int shader, String string);
|
||||
|
||||
public void stencilFuncSeparate(int face, int func, int ref, int mask);
|
||||
|
||||
public void stencilMaskSeparate(int face, int mask);
|
||||
|
||||
public void stencilOpSeparate(int face, int fail, int zfail, int zpass);
|
||||
|
||||
public void texParameterfv(int target, int pname, FloatBuffer params);
|
||||
|
||||
public void texParameteri(int target, int pname, int param);
|
||||
|
||||
public void texParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void uniform1f(int location, float x);
|
||||
|
||||
public void uniform1fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void uniform1i(int location, int x);
|
||||
|
||||
public void uniform1iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void uniform2f(int location, float x, float y);
|
||||
|
||||
public void uniform2fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void uniform2i(int location, int x, int y);
|
||||
|
||||
public void uniform2iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void uniform3f(int location, float x, float y, float z);
|
||||
|
||||
public void uniform3fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void uniform3i(int location, int x, int y, int z);
|
||||
|
||||
public void uniform3iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void uniform4f(int location, float x, float y, float z, float w);
|
||||
|
||||
public void uniform4fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void uniform4i(int location, int x, int y, int z, int w);
|
||||
|
||||
public void uniform4iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void uniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void uniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void uniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void useProgram(int program);
|
||||
|
||||
public void validateProgram(int program);
|
||||
|
||||
public void vertexAttrib1f(int indx, float x);
|
||||
|
||||
public void vertexAttrib1fv(int indx, FloatBuffer values);
|
||||
|
||||
public void vertexAttrib2f(int indx, float x, float y);
|
||||
|
||||
public void vertexAttrib2fv(int indx, FloatBuffer values);
|
||||
|
||||
public void vertexAttrib3f(int indx, float x, float y, float z);
|
||||
|
||||
public void vertexAttrib3fv(int indx, FloatBuffer values);
|
||||
|
||||
public void vertexAttrib4f(int indx, float x, float y, float z, float w);
|
||||
|
||||
public void vertexAttrib4fv(int indx, FloatBuffer values);
|
||||
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer ptr);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void vertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int offset);
|
||||
|
||||
//------------------------
|
||||
|
||||
public static final int GENERATE_MIPMAP = 0x8191;
|
||||
public static final int TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
|
||||
public static final int MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
|
||||
public void activeTexture(int texture);
|
||||
|
||||
public void bindTexture(int target, int texture);
|
||||
|
||||
public void blendFunc(int sfactor, int dfactor);
|
||||
|
||||
public void clear(int mask);
|
||||
|
||||
public void clearColor(float red, float green, float blue, float alpha);
|
||||
|
||||
public void clearDepthf(float depth);
|
||||
|
||||
public void clearStencil(int s);
|
||||
|
||||
public void colorMask(boolean red, boolean green, boolean blue, boolean alpha);
|
||||
|
||||
public void compressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border,
|
||||
int imageSize, Buffer data);
|
||||
|
||||
public void compressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format,
|
||||
int imageSize, Buffer data);
|
||||
|
||||
public void copyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border);
|
||||
|
||||
public void copyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
public void cullFace(int mode);
|
||||
|
||||
public void deleteTextures(int n, IntBuffer textures);
|
||||
|
||||
public void depthFunc(int func);
|
||||
|
||||
public void depthMask(boolean flag);
|
||||
|
||||
public void depthRangef(float zNear, float zFar);
|
||||
|
||||
public void disable(int cap);
|
||||
|
||||
public void drawArrays(int mode, int first, int count);
|
||||
|
||||
public void drawElements(int mode, int count, int type, Buffer indices);
|
||||
|
||||
public void enable(int cap);
|
||||
|
||||
public void finish();
|
||||
|
||||
public void flush();
|
||||
|
||||
public void frontFace(int mode);
|
||||
|
||||
public void genTextures(int n, IntBuffer textures);
|
||||
|
||||
public int getError();
|
||||
|
||||
public void getIntegerv(int pname, IntBuffer params);
|
||||
|
||||
public String getString(int name);
|
||||
|
||||
public void hint(int target, int mode);
|
||||
|
||||
public void lineWidth(float width);
|
||||
|
||||
public void pixelStorei(int pname, int param);
|
||||
|
||||
public void polygonOffset(float factor, float units);
|
||||
|
||||
public void readPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void scissor(int x, int y, int width, int height);
|
||||
|
||||
public void stencilFunc(int func, int ref, int mask);
|
||||
|
||||
public void stencilMask(int mask);
|
||||
|
||||
public void stencilOp(int fail, int zfail, int zpass);
|
||||
|
||||
public void texImage2D(int target, int level, int internalformat, int width, int height,
|
||||
int border, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void texParameterf(int target, int pname, float param);
|
||||
|
||||
public void texSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void viewport(int x, int y, int width, int height);
|
||||
}
|
@ -1,672 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
*
|
||||
* 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 libgdx AUTHORS file.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
package org.oscim.backend;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/**
|
||||
* Interface wrapping all the methods of OpenGL ES 2.0
|
||||
*
|
||||
* @author mzechner
|
||||
*/
|
||||
public interface GL20 {
|
||||
public static final int GL_ES_VERSION_2_0 = 1;
|
||||
public static final int GL_DEPTH_BUFFER_BIT = 0x00000100;
|
||||
public static final int GL_STENCIL_BUFFER_BIT = 0x00000400;
|
||||
public static final int GL_COLOR_BUFFER_BIT = 0x00004000;
|
||||
public static final int GL_FALSE = 0;
|
||||
public static final int GL_TRUE = 1;
|
||||
public static final int GL_POINTS = 0x0000;
|
||||
public static final int GL_LINES = 0x0001;
|
||||
public static final int GL_LINE_LOOP = 0x0002;
|
||||
public static final int GL_LINE_STRIP = 0x0003;
|
||||
public static final int GL_TRIANGLES = 0x0004;
|
||||
public static final int GL_TRIANGLE_STRIP = 0x0005;
|
||||
public static final int GL_TRIANGLE_FAN = 0x0006;
|
||||
public static final int GL_ZERO = 0;
|
||||
public static final int GL_ONE = 1;
|
||||
public static final int GL_SRC_COLOR = 0x0300;
|
||||
public static final int GL_ONE_MINUS_SRC_COLOR = 0x0301;
|
||||
public static final int GL_SRC_ALPHA = 0x0302;
|
||||
public static final int GL_ONE_MINUS_SRC_ALPHA = 0x0303;
|
||||
public static final int GL_DST_ALPHA = 0x0304;
|
||||
public static final int GL_ONE_MINUS_DST_ALPHA = 0x0305;
|
||||
public static final int GL_DST_COLOR = 0x0306;
|
||||
public static final int GL_ONE_MINUS_DST_COLOR = 0x0307;
|
||||
public static final int GL_SRC_ALPHA_SATURATE = 0x0308;
|
||||
public static final int GL_FUNC_ADD = 0x8006;
|
||||
public static final int GL_BLEND_EQUATION = 0x8009;
|
||||
public static final int GL_BLEND_EQUATION_RGB = 0x8009;
|
||||
public static final int GL_BLEND_EQUATION_ALPHA = 0x883D;
|
||||
public static final int GL_FUNC_SUBTRACT = 0x800A;
|
||||
public static final int GL_FUNC_REVERSE_SUBTRACT = 0x800B;
|
||||
public static final int GL_BLEND_DST_RGB = 0x80C8;
|
||||
public static final int GL_BLEND_SRC_RGB = 0x80C9;
|
||||
public static final int GL_BLEND_DST_ALPHA = 0x80CA;
|
||||
public static final int GL_BLEND_SRC_ALPHA = 0x80CB;
|
||||
public static final int GL_CONSTANT_COLOR = 0x8001;
|
||||
public static final int GL_ONE_MINUS_CONSTANT_COLOR = 0x8002;
|
||||
public static final int GL_CONSTANT_ALPHA = 0x8003;
|
||||
public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 0x8004;
|
||||
public static final int GL_BLEND_COLOR = 0x8005;
|
||||
public static final int GL_ARRAY_BUFFER = 0x8892;
|
||||
public static final int GL_ELEMENT_ARRAY_BUFFER = 0x8893;
|
||||
public static final int GL_ARRAY_BUFFER_BINDING = 0x8894;
|
||||
public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
|
||||
public static final int GL_STREAM_DRAW = 0x88E0;
|
||||
public static final int GL_STATIC_DRAW = 0x88E4;
|
||||
public static final int GL_DYNAMIC_DRAW = 0x88E8;
|
||||
public static final int GL_BUFFER_SIZE = 0x8764;
|
||||
public static final int GL_BUFFER_USAGE = 0x8765;
|
||||
public static final int GL_CURRENT_VERTEX_ATTRIB = 0x8626;
|
||||
public static final int GL_FRONT = 0x0404;
|
||||
public static final int GL_BACK = 0x0405;
|
||||
public static final int GL_FRONT_AND_BACK = 0x0408;
|
||||
public static final int GL_TEXTURE_2D = 0x0DE1;
|
||||
public static final int GL_CULL_FACE = 0x0B44;
|
||||
public static final int GL_BLEND = 0x0BE2;
|
||||
public static final int GL_DITHER = 0x0BD0;
|
||||
public static final int GL_STENCIL_TEST = 0x0B90;
|
||||
public static final int GL_DEPTH_TEST = 0x0B71;
|
||||
public static final int GL_SCISSOR_TEST = 0x0C11;
|
||||
public static final int GL_POLYGON_OFFSET_FILL = 0x8037;
|
||||
public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
|
||||
public static final int GL_SAMPLE_COVERAGE = 0x80A0;
|
||||
//public static final int GL_NO_ERROR = 0;
|
||||
public static final int GL_INVALID_ENUM = 0x0500;
|
||||
public static final int GL_INVALID_VALUE = 0x0501;
|
||||
public static final int GL_INVALID_OPERATION = 0x0502;
|
||||
public static final int GL_OUT_OF_MEMORY = 0x0505;
|
||||
public static final int GL_CW = 0x0900;
|
||||
public static final int GL_CCW = 0x0901;
|
||||
public static final int GL_LINE_WIDTH = 0x0B21;
|
||||
public static final int GL_ALIASED_POINT_SIZE_RANGE = 0x846D;
|
||||
public static final int GL_ALIASED_LINE_WIDTH_RANGE = 0x846E;
|
||||
public static final int GL_CULL_FACE_MODE = 0x0B45;
|
||||
public static final int GL_FRONT_FACE = 0x0B46;
|
||||
public static final int GL_DEPTH_RANGE = 0x0B70;
|
||||
public static final int GL_DEPTH_WRITEMASK = 0x0B72;
|
||||
public static final int GL_DEPTH_CLEAR_VALUE = 0x0B73;
|
||||
public static final int GL_DEPTH_FUNC = 0x0B74;
|
||||
public static final int GL_STENCIL_CLEAR_VALUE = 0x0B91;
|
||||
public static final int GL_STENCIL_FUNC = 0x0B92;
|
||||
public static final int GL_STENCIL_FAIL = 0x0B94;
|
||||
public static final int GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95;
|
||||
public static final int GL_STENCIL_PASS_DEPTH_PASS = 0x0B96;
|
||||
public static final int GL_STENCIL_REF = 0x0B97;
|
||||
public static final int GL_STENCIL_VALUE_MASK = 0x0B93;
|
||||
public static final int GL_STENCIL_WRITEMASK = 0x0B98;
|
||||
public static final int GL_STENCIL_BACK_FUNC = 0x8800;
|
||||
public static final int GL_STENCIL_BACK_FAIL = 0x8801;
|
||||
public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
|
||||
public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
|
||||
public static final int GL_STENCIL_BACK_REF = 0x8CA3;
|
||||
public static final int GL_STENCIL_BACK_VALUE_MASK = 0x8CA4;
|
||||
public static final int GL_STENCIL_BACK_WRITEMASK = 0x8CA5;
|
||||
public static final int GL_VIEWPORT = 0x0BA2;
|
||||
public static final int GL_SCISSOR_BOX = 0x0C10;
|
||||
public static final int GL_COLOR_CLEAR_VALUE = 0x0C22;
|
||||
public static final int GL_COLOR_WRITEMASK = 0x0C23;
|
||||
public static final int GL_UNPACK_ALIGNMENT = 0x0CF5;
|
||||
public static final int GL_PACK_ALIGNMENT = 0x0D05;
|
||||
public static final int GL_MAX_TEXTURE_SIZE = 0x0D33;
|
||||
public static final int GL_MAX_TEXTURE_UNITS = 0x84E2;
|
||||
public static final int GL_MAX_VIEWPORT_DIMS = 0x0D3A;
|
||||
public static final int GL_SUBPIXEL_BITS = 0x0D50;
|
||||
public static final int GL_RED_BITS = 0x0D52;
|
||||
public static final int GL_GREEN_BITS = 0x0D53;
|
||||
public static final int GL_BLUE_BITS = 0x0D54;
|
||||
public static final int GL_ALPHA_BITS = 0x0D55;
|
||||
public static final int GL_DEPTH_BITS = 0x0D56;
|
||||
public static final int GL_STENCIL_BITS = 0x0D57;
|
||||
public static final int GL_POLYGON_OFFSET_UNITS = 0x2A00;
|
||||
public static final int GL_POLYGON_OFFSET_FACTOR = 0x8038;
|
||||
public static final int GL_TEXTURE_BINDING_2D = 0x8069;
|
||||
public static final int GL_SAMPLE_BUFFERS = 0x80A8;
|
||||
public static final int GL_SAMPLES = 0x80A9;
|
||||
public static final int GL_SAMPLE_COVERAGE_VALUE = 0x80AA;
|
||||
public static final int GL_SAMPLE_COVERAGE_INVERT = 0x80AB;
|
||||
public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
|
||||
public static final int GL_COMPRESSED_TEXTURE_FORMATS = 0x86A3;
|
||||
public static final int GL_DONT_CARE = 0x1100;
|
||||
public static final int GL_FASTEST = 0x1101;
|
||||
public static final int GL_NICEST = 0x1102;
|
||||
public static final int GL_GENERATE_MIPMAP_HINT = 0x8192;
|
||||
public static final int GL_BYTE = 0x1400;
|
||||
public static final int GL_UNSIGNED_BYTE = 0x1401;
|
||||
public static final int GL_SHORT = 0x1402;
|
||||
public static final int GL_UNSIGNED_SHORT = 0x1403;
|
||||
public static final int GL_INT = 0x1404;
|
||||
public static final int GL_UNSIGNED_INT = 0x1405;
|
||||
public static final int GL_FLOAT = 0x1406;
|
||||
public static final int GL_FIXED = 0x140C;
|
||||
public static final int GL_DEPTH_COMPONENT = 0x1902;
|
||||
public static final int GL_ALPHA = 0x1906;
|
||||
public static final int GL_RGB = 0x1907;
|
||||
public static final int GL_RGBA = 0x1908;
|
||||
public static final int GL_LUMINANCE = 0x1909;
|
||||
public static final int GL_LUMINANCE_ALPHA = 0x190A;
|
||||
public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033;
|
||||
public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034;
|
||||
public static final int GL_UNSIGNED_SHORT_5_6_5 = 0x8363;
|
||||
public static final int GL_FRAGMENT_SHADER = 0x8B30;
|
||||
public static final int GL_VERTEX_SHADER = 0x8B31;
|
||||
public static final int GL_MAX_VERTEX_ATTRIBS = 0x8869;
|
||||
public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
|
||||
public static final int GL_MAX_VARYING_VECTORS = 0x8DFC;
|
||||
public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
|
||||
public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
|
||||
public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 0x8872;
|
||||
public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
|
||||
public static final int GL_SHADER_TYPE = 0x8B4F;
|
||||
public static final int GL_DELETE_STATUS = 0x8B80;
|
||||
public static final int GL_LINK_STATUS = 0x8B82;
|
||||
public static final int GL_VALIDATE_STATUS = 0x8B83;
|
||||
public static final int GL_ATTACHED_SHADERS = 0x8B85;
|
||||
public static final int GL_ACTIVE_UNIFORMS = 0x8B86;
|
||||
public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH = 0x8B87;
|
||||
public static final int GL_ACTIVE_ATTRIBUTES = 0x8B89;
|
||||
public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 0x8B8A;
|
||||
public static final int GL_SHADING_LANGUAGE_VERSION = 0x8B8C;
|
||||
public static final int GL_CURRENT_PROGRAM = 0x8B8D;
|
||||
public static final int GL_NEVER = 0x0200;
|
||||
public static final int GL_LESS = 0x0201;
|
||||
public static final int GL_EQUAL = 0x0202;
|
||||
public static final int GL_LEQUAL = 0x0203;
|
||||
public static final int GL_GREATER = 0x0204;
|
||||
public static final int GL_NOTEQUAL = 0x0205;
|
||||
public static final int GL_GEQUAL = 0x0206;
|
||||
public static final int GL_ALWAYS = 0x0207;
|
||||
public static final int GL_KEEP = 0x1E00;
|
||||
public static final int GL_REPLACE = 0x1E01;
|
||||
public static final int GL_INCR = 0x1E02;
|
||||
public static final int GL_DECR = 0x1E03;
|
||||
public static final int GL_INVERT = 0x150A;
|
||||
public static final int GL_INCR_WRAP = 0x8507;
|
||||
public static final int GL_DECR_WRAP = 0x8508;
|
||||
public static final int GL_VENDOR = 0x1F00;
|
||||
public static final int GL_RENDERER = 0x1F01;
|
||||
public static final int GL_VERSION = 0x1F02;
|
||||
public static final int GL_EXTENSIONS = 0x1F03;
|
||||
public static final int GL_NEAREST = 0x2600;
|
||||
public static final int GL_LINEAR = 0x2601;
|
||||
public static final int GL_NEAREST_MIPMAP_NEAREST = 0x2700;
|
||||
public static final int GL_LINEAR_MIPMAP_NEAREST = 0x2701;
|
||||
public static final int GL_NEAREST_MIPMAP_LINEAR = 0x2702;
|
||||
public static final int GL_LINEAR_MIPMAP_LINEAR = 0x2703;
|
||||
public static final int GL_TEXTURE_MAG_FILTER = 0x2800;
|
||||
public static final int GL_TEXTURE_MIN_FILTER = 0x2801;
|
||||
public static final int GL_TEXTURE_WRAP_S = 0x2802;
|
||||
public static final int GL_TEXTURE_WRAP_T = 0x2803;
|
||||
public static final int GL_TEXTURE = 0x1702;
|
||||
public static final int GL_TEXTURE_CUBE_MAP = 0x8513;
|
||||
public static final int GL_TEXTURE_BINDING_CUBE_MAP = 0x8514;
|
||||
public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
|
||||
public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
|
||||
public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
|
||||
public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
|
||||
public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
|
||||
public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
|
||||
public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
|
||||
public static final int GL_TEXTURE0 = 0x84C0;
|
||||
public static final int GL_TEXTURE1 = 0x84C1;
|
||||
public static final int GL_TEXTURE2 = 0x84C2;
|
||||
public static final int GL_TEXTURE3 = 0x84C3;
|
||||
public static final int GL_TEXTURE4 = 0x84C4;
|
||||
public static final int GL_TEXTURE5 = 0x84C5;
|
||||
public static final int GL_TEXTURE6 = 0x84C6;
|
||||
public static final int GL_TEXTURE7 = 0x84C7;
|
||||
public static final int GL_TEXTURE8 = 0x84C8;
|
||||
public static final int GL_TEXTURE9 = 0x84C9;
|
||||
public static final int GL_TEXTURE10 = 0x84CA;
|
||||
public static final int GL_TEXTURE11 = 0x84CB;
|
||||
public static final int GL_TEXTURE12 = 0x84CC;
|
||||
public static final int GL_TEXTURE13 = 0x84CD;
|
||||
public static final int GL_TEXTURE14 = 0x84CE;
|
||||
public static final int GL_TEXTURE15 = 0x84CF;
|
||||
public static final int GL_TEXTURE16 = 0x84D0;
|
||||
public static final int GL_TEXTURE17 = 0x84D1;
|
||||
public static final int GL_TEXTURE18 = 0x84D2;
|
||||
public static final int GL_TEXTURE19 = 0x84D3;
|
||||
public static final int GL_TEXTURE20 = 0x84D4;
|
||||
public static final int GL_TEXTURE21 = 0x84D5;
|
||||
public static final int GL_TEXTURE22 = 0x84D6;
|
||||
public static final int GL_TEXTURE23 = 0x84D7;
|
||||
public static final int GL_TEXTURE24 = 0x84D8;
|
||||
public static final int GL_TEXTURE25 = 0x84D9;
|
||||
public static final int GL_TEXTURE26 = 0x84DA;
|
||||
public static final int GL_TEXTURE27 = 0x84DB;
|
||||
public static final int GL_TEXTURE28 = 0x84DC;
|
||||
public static final int GL_TEXTURE29 = 0x84DD;
|
||||
public static final int GL_TEXTURE30 = 0x84DE;
|
||||
public static final int GL_TEXTURE31 = 0x84DF;
|
||||
public static final int GL_ACTIVE_TEXTURE = 0x84E0;
|
||||
public static final int GL_REPEAT = 0x2901;
|
||||
public static final int GL_CLAMP_TO_EDGE = 0x812F;
|
||||
public static final int GL_MIRRORED_REPEAT = 0x8370;
|
||||
public static final int GL_FLOAT_VEC2 = 0x8B50;
|
||||
public static final int GL_FLOAT_VEC3 = 0x8B51;
|
||||
public static final int GL_FLOAT_VEC4 = 0x8B52;
|
||||
public static final int GL_INT_VEC2 = 0x8B53;
|
||||
public static final int GL_INT_VEC3 = 0x8B54;
|
||||
public static final int GL_INT_VEC4 = 0x8B55;
|
||||
public static final int GL_BOOL = 0x8B56;
|
||||
public static final int GL_BOOL_VEC2 = 0x8B57;
|
||||
public static final int GL_BOOL_VEC3 = 0x8B58;
|
||||
public static final int GL_BOOL_VEC4 = 0x8B59;
|
||||
public static final int GL_FLOAT_MAT2 = 0x8B5A;
|
||||
public static final int GL_FLOAT_MAT3 = 0x8B5B;
|
||||
public static final int GL_FLOAT_MAT4 = 0x8B5C;
|
||||
public static final int GL_SAMPLER_2D = 0x8B5E;
|
||||
public static final int GL_SAMPLER_CUBE = 0x8B60;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
|
||||
public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
|
||||
public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
|
||||
public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
|
||||
public static final int GL_COMPILE_STATUS = 0x8B81;
|
||||
public static final int GL_INFO_LOG_LENGTH = 0x8B84;
|
||||
public static final int GL_SHADER_SOURCE_LENGTH = 0x8B88;
|
||||
public static final int GL_SHADER_COMPILER = 0x8DFA;
|
||||
public static final int GL_SHADER_BINARY_FORMATS = 0x8DF8;
|
||||
public static final int GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9;
|
||||
public static final int GL_LOW_FLOAT = 0x8DF0;
|
||||
public static final int GL_MEDIUM_FLOAT = 0x8DF1;
|
||||
public static final int GL_HIGH_FLOAT = 0x8DF2;
|
||||
public static final int GL_LOW_INT = 0x8DF3;
|
||||
public static final int GL_MEDIUM_INT = 0x8DF4;
|
||||
public static final int GL_HIGH_INT = 0x8DF5;
|
||||
public static final int GL_FRAMEBUFFER = 0x8D40;
|
||||
public static final int GL_RENDERBUFFER = 0x8D41;
|
||||
public static final int GL_RGBA4 = 0x8056;
|
||||
public static final int GL_RGB5_A1 = 0x8057;
|
||||
public static final int GL_RGB565 = 0x8D62;
|
||||
public static final int GL_DEPTH_COMPONENT16 = 0x81A5;
|
||||
public static final int GL_STENCIL_INDEX = 0x1901;
|
||||
public static final int GL_STENCIL_INDEX8 = 0x8D48;
|
||||
public static final int GL_RENDERBUFFER_WIDTH = 0x8D42;
|
||||
public static final int GL_RENDERBUFFER_HEIGHT = 0x8D43;
|
||||
public static final int GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
|
||||
public static final int GL_RENDERBUFFER_RED_SIZE = 0x8D50;
|
||||
public static final int GL_RENDERBUFFER_GREEN_SIZE = 0x8D51;
|
||||
public static final int GL_RENDERBUFFER_BLUE_SIZE = 0x8D52;
|
||||
public static final int GL_RENDERBUFFER_ALPHA_SIZE = 0x8D53;
|
||||
public static final int GL_RENDERBUFFER_DEPTH_SIZE = 0x8D54;
|
||||
public static final int GL_RENDERBUFFER_STENCIL_SIZE = 0x8D55;
|
||||
public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
|
||||
public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
|
||||
public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
|
||||
public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
|
||||
public static final int GL_COLOR_ATTACHMENT0 = 0x8CE0;
|
||||
public static final int GL_DEPTH_ATTACHMENT = 0x8D00;
|
||||
public static final int GL_STENCIL_ATTACHMENT = 0x8D20;
|
||||
public static final int GL_NONE = 0;
|
||||
public static final int GL_FRAMEBUFFER_COMPLETE = 0x8CD5;
|
||||
public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
|
||||
public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
|
||||
public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
|
||||
public static final int GL_FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
|
||||
public static final int GL_FRAMEBUFFER_BINDING = 0x8CA6;
|
||||
public static final int GL_RENDERBUFFER_BINDING = 0x8CA7;
|
||||
public static final int GL_MAX_RENDERBUFFER_SIZE = 0x84E8;
|
||||
public static final int GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506;
|
||||
public static final int GL_VERTEX_PROGRAM_POINT_SIZE = 0x8642;
|
||||
|
||||
// Extensions
|
||||
public static final int GL_COVERAGE_BUFFER_BIT_NV = 0x8000;
|
||||
|
||||
public void glAttachShader(int program, int shader);
|
||||
|
||||
public void glBindAttribLocation(int program, int index, String name);
|
||||
|
||||
public void glBindBuffer(int target, int buffer);
|
||||
|
||||
public void glBindFramebuffer(int target, int framebuffer);
|
||||
|
||||
public void glBindRenderbuffer(int target, int renderbuffer);
|
||||
|
||||
public void glBlendColor(float red, float green, float blue, float alpha);
|
||||
|
||||
public void glBlendEquation(int mode);
|
||||
|
||||
public void glBlendEquationSeparate(int modeRGB, int modeAlpha);
|
||||
|
||||
public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha);
|
||||
|
||||
public void glBufferData(int target, int size, Buffer data, int usage);
|
||||
|
||||
public void glBufferSubData(int target, int offset, int size, Buffer data);
|
||||
|
||||
public int glCheckFramebufferStatus(int target);
|
||||
|
||||
public void glCompileShader(int shader);
|
||||
|
||||
public int glCreateProgram();
|
||||
|
||||
public int glCreateShader(int type);
|
||||
|
||||
public void glDeleteBuffers(int n, IntBuffer buffers);
|
||||
|
||||
public void glDeleteFramebuffers(int n, IntBuffer framebuffers);
|
||||
|
||||
public void glDeleteProgram(int program);
|
||||
|
||||
public void glDeleteRenderbuffers(int n, IntBuffer renderbuffers);
|
||||
|
||||
public void glDeleteShader(int shader);
|
||||
|
||||
public void glDetachShader(int program, int shader);
|
||||
|
||||
public void glDisableVertexAttribArray(int index);
|
||||
|
||||
public void glDrawElements(int mode, int count, int type, int offset);
|
||||
|
||||
public void glEnableVertexAttribArray(int index);
|
||||
|
||||
public void glFramebufferRenderbuffer(int target, int attachment, int renderbuffertarget,
|
||||
int renderbuffer);
|
||||
|
||||
public void glFramebufferTexture2D(int target, int attachment, int textarget, int texture,
|
||||
int level);
|
||||
|
||||
public void glGenBuffers(int n, IntBuffer buffers);
|
||||
|
||||
public void glGenerateMipmap(int target);
|
||||
|
||||
public void glGenFramebuffers(int n, IntBuffer framebuffers);
|
||||
|
||||
public void glGenRenderbuffers(int n, IntBuffer renderbuffers);
|
||||
|
||||
// deviates
|
||||
public String glGetActiveAttrib(int program, int index, IntBuffer size, Buffer type);
|
||||
|
||||
// deviates
|
||||
public String glGetActiveUniform(int program, int index, IntBuffer size, Buffer type);
|
||||
|
||||
public void glGetAttachedShaders(int program, int maxcount, Buffer count, IntBuffer shaders);
|
||||
|
||||
public int glGetAttribLocation(int program, String name);
|
||||
|
||||
public void glGetBooleanv(int pname, Buffer params);
|
||||
|
||||
public void glGetBufferParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glGetFloatv(int pname, FloatBuffer params);
|
||||
|
||||
public void glGetFramebufferAttachmentParameteriv(int target, int attachment, int pname,
|
||||
IntBuffer params);
|
||||
|
||||
public void glGetProgramiv(int program, int pname, IntBuffer params);
|
||||
|
||||
// deviates
|
||||
public String glGetProgramInfoLog(int program);
|
||||
|
||||
public void glGetRenderbufferParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glGetShaderiv(int shader, int pname, IntBuffer params);
|
||||
|
||||
// deviates
|
||||
public String glGetShaderInfoLog(int shader);
|
||||
|
||||
public void glGetShaderPrecisionFormat(int shadertype, int precisiontype, IntBuffer range,
|
||||
IntBuffer precision);
|
||||
|
||||
public void glGetShaderSource(int shader, int bufsize, Buffer length, String source);
|
||||
|
||||
public void glGetTexParameterfv(int target, int pname, FloatBuffer params);
|
||||
|
||||
public void glGetTexParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glGetUniformfv(int program, int location, FloatBuffer params);
|
||||
|
||||
public void glGetUniformiv(int program, int location, IntBuffer params);
|
||||
|
||||
public int glGetUniformLocation(int program, String name);
|
||||
|
||||
public void glGetVertexAttribfv(int index, int pname, FloatBuffer params);
|
||||
|
||||
public void glGetVertexAttribiv(int index, int pname, IntBuffer params);
|
||||
|
||||
public void glGetVertexAttribPointerv(int index, int pname, Buffer pointer);
|
||||
|
||||
public boolean glIsBuffer(int buffer);
|
||||
|
||||
public boolean glIsEnabled(int cap);
|
||||
|
||||
public boolean glIsFramebuffer(int framebuffer);
|
||||
|
||||
public boolean glIsProgram(int program);
|
||||
|
||||
public boolean glIsRenderbuffer(int renderbuffer);
|
||||
|
||||
public boolean glIsShader(int shader);
|
||||
|
||||
public boolean glIsTexture(int texture);
|
||||
|
||||
public void glLinkProgram(int program);
|
||||
|
||||
public void glReleaseShaderCompiler();
|
||||
|
||||
public void glRenderbufferStorage(int target, int internalformat, int width, int height);
|
||||
|
||||
public void glSampleCoverage(float value, boolean invert);
|
||||
|
||||
public void glShaderBinary(int n, IntBuffer shaders, int binaryformat, Buffer binary, int length);
|
||||
|
||||
// Deviates
|
||||
public void glShaderSource(int shader, String string);
|
||||
|
||||
public void glStencilFuncSeparate(int face, int func, int ref, int mask);
|
||||
|
||||
public void glStencilMaskSeparate(int face, int mask);
|
||||
|
||||
public void glStencilOpSeparate(int face, int fail, int zfail, int zpass);
|
||||
|
||||
public void glTexParameterfv(int target, int pname, FloatBuffer params);
|
||||
|
||||
public void glTexParameteri(int target, int pname, int param);
|
||||
|
||||
public void glTexParameteriv(int target, int pname, IntBuffer params);
|
||||
|
||||
public void glUniform1f(int location, float x);
|
||||
|
||||
public void glUniform1fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform1i(int location, int x);
|
||||
|
||||
public void glUniform1iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniform2f(int location, float x, float y);
|
||||
|
||||
public void glUniform2fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform2i(int location, int x, int y);
|
||||
|
||||
public void glUniform2iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniform3f(int location, float x, float y, float z);
|
||||
|
||||
public void glUniform3fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform3i(int location, int x, int y, int z);
|
||||
|
||||
public void glUniform3iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniform4f(int location, float x, float y, float z, float w);
|
||||
|
||||
public void glUniform4fv(int location, int count, FloatBuffer v);
|
||||
|
||||
public void glUniform4i(int location, int x, int y, int z, int w);
|
||||
|
||||
public void glUniform4iv(int location, int count, IntBuffer v);
|
||||
|
||||
public void glUniformMatrix2fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void glUniformMatrix3fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void glUniformMatrix4fv(int location, int count, boolean transpose, FloatBuffer value);
|
||||
|
||||
public void glUseProgram(int program);
|
||||
|
||||
public void glValidateProgram(int program);
|
||||
|
||||
public void glVertexAttrib1f(int indx, float x);
|
||||
|
||||
public void glVertexAttrib1fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttrib2f(int indx, float x, float y);
|
||||
|
||||
public void glVertexAttrib2fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttrib3f(int indx, float x, float y, float z);
|
||||
|
||||
public void glVertexAttrib3fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttrib4f(int indx, float x, float y, float z, float w);
|
||||
|
||||
public void glVertexAttrib4fv(int indx, FloatBuffer values);
|
||||
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
Buffer ptr);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void glVertexAttribPointer(int indx, int size, int type, boolean normalized, int stride,
|
||||
int offset);
|
||||
|
||||
//------------------------
|
||||
|
||||
public static final int GL_GENERATE_MIPMAP = 0x8191;
|
||||
public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
|
||||
public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
|
||||
|
||||
public void glActiveTexture(int texture);
|
||||
|
||||
public void glBindTexture(int target, int texture);
|
||||
|
||||
public void glBlendFunc(int sfactor, int dfactor);
|
||||
|
||||
public void glClear(int mask);
|
||||
|
||||
public void glClearColor(float red, float green, float blue, float alpha);
|
||||
|
||||
public void glClearDepthf(float depth);
|
||||
|
||||
public void glClearStencil(int s);
|
||||
|
||||
public void glColorMask(boolean red, boolean green, boolean blue, boolean alpha);
|
||||
|
||||
public void glCompressedTexImage2D(int target, int level, int internalformat, int width,
|
||||
int height, int border,
|
||||
int imageSize, Buffer data);
|
||||
|
||||
public void glCompressedTexSubImage2D(int target, int level, int xoffset, int yoffset,
|
||||
int width, int height, int format,
|
||||
int imageSize, Buffer data);
|
||||
|
||||
public void glCopyTexImage2D(int target, int level, int internalformat, int x, int y,
|
||||
int width, int height, int border);
|
||||
|
||||
public void glCopyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y,
|
||||
int width, int height);
|
||||
|
||||
public void glCullFace(int mode);
|
||||
|
||||
public void glDeleteTextures(int n, IntBuffer textures);
|
||||
|
||||
public void glDepthFunc(int func);
|
||||
|
||||
public void glDepthMask(boolean flag);
|
||||
|
||||
public void glDepthRangef(float zNear, float zFar);
|
||||
|
||||
public void glDisable(int cap);
|
||||
|
||||
public void glDrawArrays(int mode, int first, int count);
|
||||
|
||||
public void glDrawElements(int mode, int count, int type, Buffer indices);
|
||||
|
||||
public void glEnable(int cap);
|
||||
|
||||
public void glFinish();
|
||||
|
||||
public void glFlush();
|
||||
|
||||
public void glFrontFace(int mode);
|
||||
|
||||
public void glGenTextures(int n, IntBuffer textures);
|
||||
|
||||
public int glGetError();
|
||||
|
||||
public void glGetIntegerv(int pname, IntBuffer params);
|
||||
|
||||
public String glGetString(int name);
|
||||
|
||||
public void glHint(int target, int mode);
|
||||
|
||||
public void glLineWidth(float width);
|
||||
|
||||
public void glPixelStorei(int pname, int param);
|
||||
|
||||
public void glPolygonOffset(float factor, float units);
|
||||
|
||||
public void glReadPixels(int x, int y, int width, int height, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void glScissor(int x, int y, int width, int height);
|
||||
|
||||
public void glStencilFunc(int func, int ref, int mask);
|
||||
|
||||
public void glStencilMask(int mask);
|
||||
|
||||
public void glStencilOp(int fail, int zfail, int zpass);
|
||||
|
||||
public void glTexImage2D(int target, int level, int internalformat, int width, int height,
|
||||
int border, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void glTexParameterf(int target, int pname, float param);
|
||||
|
||||
public void glTexSubImage2D(int target, int level, int xoffset, int yoffset, int width,
|
||||
int height, int format, int type,
|
||||
Buffer pixels);
|
||||
|
||||
public void glViewport(int x, int y, int width, int height);
|
||||
}
|
@ -22,7 +22,7 @@ public class GLAdapter {
|
||||
public final static boolean debugView = false;
|
||||
|
||||
/** The instance provided by backend */
|
||||
private static GL20 g;
|
||||
public static GL gl;
|
||||
|
||||
public static boolean GDX_DESKTOP_QUIRKS = false;
|
||||
public static boolean GDX_WEBGL_QUIRKS = false;
|
||||
@ -33,14 +33,7 @@ public class GLAdapter {
|
||||
*/
|
||||
public static boolean NO_BUFFER_SUB_DATA = false;
|
||||
|
||||
public static GL20 get() {
|
||||
if (g == null)
|
||||
throw new IllegalStateException();
|
||||
|
||||
return g;
|
||||
}
|
||||
|
||||
public static void init(GL20 gl20) {
|
||||
g = gl20;
|
||||
public static void init(GL gl20) {
|
||||
gl = gl20;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012 osmdroid authors:
|
||||
* Copyright 2012 Nicolas Gramlich
|
||||
* Copyright 2012 Theodore Hong
|
||||
* Copyright 2012 Fred Eisele
|
||||
* Copyright 2012 osmdroid authors: Nicolas Gramlich, Theodore Hong, Fred Eisele
|
||||
*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.oscim.layers.tile;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_EQUAL;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.layers.tile.MapTile.PROXY_GRAMPA;
|
||||
import static org.oscim.layers.tile.MapTile.PROXY_PARENT;
|
||||
import static org.oscim.layers.tile.MapTile.State.READY;
|
||||
@ -12,7 +12,7 @@ import static org.oscim.renderer.bucket.RenderBucket.MESH;
|
||||
import static org.oscim.renderer.bucket.RenderBucket.POLYGON;
|
||||
import static org.oscim.renderer.bucket.RenderBucket.TEXLINE;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.MapPosition;
|
||||
import org.oscim.core.Tile;
|
||||
@ -68,13 +68,13 @@ public class VectorTileRenderer extends TileRenderer {
|
||||
MapTile t = tiles[i];
|
||||
|
||||
if (t.isVisible && !t.state(READY)) {
|
||||
GL.glDepthMask(true);
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
gl.depthMask(true);
|
||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||
|
||||
/* always write depth for non-proxy tiles
|
||||
* this is used in drawProxies pass to not
|
||||
* draw where tiles were already drawn */
|
||||
GL.glDepthFunc(GL20.GL_ALWAYS);
|
||||
gl.depthFunc(GL.ALWAYS);
|
||||
|
||||
mClipMode = PolygonBucket.CLIP_DEPTH;
|
||||
drawProxies = true;
|
||||
@ -98,7 +98,7 @@ public class VectorTileRenderer extends TileRenderer {
|
||||
return;
|
||||
|
||||
/* only draw where no other tile is drawn */
|
||||
GL.glDepthFunc(GL20.GL_LESS);
|
||||
gl.depthFunc(GL.LESS);
|
||||
|
||||
/* draw child or parent proxies */
|
||||
boolean preferParent = (v.pos.getZoomScale() < 1.5)
|
||||
@ -135,10 +135,10 @@ public class VectorTileRenderer extends TileRenderer {
|
||||
drawGrandParent(t, v);
|
||||
}
|
||||
|
||||
GL.glDepthMask(false);
|
||||
gl.depthMask(false);
|
||||
|
||||
/* make sure stencil buffer write is disabled */
|
||||
//GL.glStencilMask(0x00);
|
||||
//GL.stencilMask(0x00);
|
||||
}
|
||||
|
||||
private void drawTile(MapTile tile, GLViewport v, int proxyLevel) {
|
||||
@ -187,7 +187,7 @@ public class VectorTileRenderer extends TileRenderer {
|
||||
b = PolygonBucket.Renderer.draw(b, v, div, first);
|
||||
first = false;
|
||||
/* set test for clip to tile region */
|
||||
GL.glStencilFunc(GL_EQUAL, 0x80, 0x80);
|
||||
gl.stencilFunc(GL.EQUAL, 0x80, 0x80);
|
||||
break;
|
||||
case LINE:
|
||||
b = LineBucket.Renderer.draw(b, v, scale, buckets);
|
||||
|
@ -17,11 +17,13 @@
|
||||
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
import javax.annotation.CheckReturnValue;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
import org.slf4j.Logger;
|
||||
@ -32,8 +34,6 @@ public final class BufferObject extends Inlist<BufferObject> {
|
||||
private static final int MB = 1024 * 1024;
|
||||
private static final int LIMIT_BUFFERS = 16 * MB;
|
||||
|
||||
private static GL20 GL;
|
||||
|
||||
/** GL identifier */
|
||||
private int id;
|
||||
|
||||
@ -65,12 +65,12 @@ public final class BufferObject extends Inlist<BufferObject> {
|
||||
* memory is less then four times the new data */
|
||||
if (!GLAdapter.NO_BUFFER_SUB_DATA && !clear &&
|
||||
(size > newSize) && (size < newSize * 4)) {
|
||||
GL.glBufferSubData(target, 0, newSize, buf);
|
||||
gl.bufferSubData(target, 0, newSize, buf);
|
||||
} else {
|
||||
mBufferMemoryUsage += newSize - size;
|
||||
size = newSize;
|
||||
//GL.glBufferData(target, size, buf, GL20.GL_DYNAMIC_DRAW);
|
||||
GL.glBufferData(target, size, buf, GL20.GL_STATIC_DRAW);
|
||||
//GL.bufferData(target, size, buf, GL20.DYNAMIC_DRAW);
|
||||
gl.bufferData(target, size, buf, GL.STATIC_DRAW);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,12 +100,12 @@ public final class BufferObject extends Inlist<BufferObject> {
|
||||
private final static int counter[] = new int[2];
|
||||
|
||||
/**
|
||||
* @param target can be GL20.GL_ARRAY_BUFFER or GL20.GL_ELEMENT_ARRAY_BUFFER
|
||||
* @param target can be GL20.ARRAY_BUFFER or GL20.ELEMENT_ARRAY_BUFFER
|
||||
* @param size requested size in bytes. optional - can be 0.
|
||||
*/
|
||||
public static synchronized BufferObject get(int target, int size) {
|
||||
|
||||
int t = (target == GL20.GL_ARRAY_BUFFER) ? 0 : 1;
|
||||
int t = (target == GL.ARRAY_BUFFER) ? 0 : 1;
|
||||
|
||||
if (pool[t] == null) {
|
||||
if (counter[t] != 0)
|
||||
@ -153,7 +153,7 @@ public final class BufferObject extends Inlist<BufferObject> {
|
||||
// if (counter > 200) {
|
||||
// log.debug("should clear some buffers " + counter);
|
||||
// }
|
||||
int t = (bo.target == GL20.GL_ARRAY_BUFFER) ? 0 : 1;
|
||||
int t = (bo.target == GL.ARRAY_BUFFER) ? 0 : 1;
|
||||
|
||||
bo.next = pool[t];
|
||||
pool[t] = bo;
|
||||
@ -209,7 +209,7 @@ public final class BufferObject extends Inlist<BufferObject> {
|
||||
static void createBuffers(int target, int num) {
|
||||
int[] mVboIds = GLUtils.glGenBuffers(num);
|
||||
|
||||
int t = (target == GL20.GL_ARRAY_BUFFER) ? 0 : 1;
|
||||
int t = (target == GL.ARRAY_BUFFER) ? 0 : 1;
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
BufferObject bo = new BufferObject(target, mVboIds[i]);
|
||||
@ -227,10 +227,8 @@ public final class BufferObject extends Inlist<BufferObject> {
|
||||
counter[1] = 0;
|
||||
}
|
||||
|
||||
static synchronized void init(GL20 gl, int num) {
|
||||
GL = gl;
|
||||
|
||||
createBuffers(GL20.GL_ARRAY_BUFFER, num);
|
||||
static synchronized void init(int num) {
|
||||
createBuffers(GL.ARRAY_BUFFER, num);
|
||||
counter[0] += num;
|
||||
}
|
||||
|
||||
|
@ -16,18 +16,9 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_CULL_FACE;
|
||||
import static org.oscim.backend.GL20.GL_DEPTH_BUFFER_BIT;
|
||||
import static org.oscim.backend.GL20.GL_EQUAL;
|
||||
import static org.oscim.backend.GL20.GL_LEQUAL;
|
||||
import static org.oscim.backend.GL20.GL_LESS;
|
||||
import static org.oscim.backend.GL20.GL_LINES;
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLES;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_BYTE;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_SHORT;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.renderer.bucket.ExtrusionBucket;
|
||||
import org.oscim.renderer.bucket.ExtrusionBuckets;
|
||||
@ -80,21 +71,21 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
|
||||
for (ExtrusionBucket eb = ebs.buckets(); eb != null; eb = eb.next()) {
|
||||
|
||||
GL.glVertexAttribPointer(vertexPointer, 3,
|
||||
GL_SHORT, false, 8,
|
||||
eb.getVertexOffset());
|
||||
gl.vertexAttribPointer(vertexPointer, 3,
|
||||
GL.SHORT, false, 8,
|
||||
eb.getVertexOffset());
|
||||
|
||||
int sumIndices = eb.idx[0] + eb.idx[1] + eb.idx[2];
|
||||
|
||||
/* extrusion */
|
||||
if (sumIndices > 0)
|
||||
GL.glDrawElements(GL_TRIANGLES, sumIndices,
|
||||
GL_UNSIGNED_SHORT, eb.off[0]);
|
||||
gl.drawElements(GL.TRIANGLES, sumIndices,
|
||||
GL.UNSIGNED_SHORT, eb.off[0]);
|
||||
|
||||
/* mesh */
|
||||
if (eb.idx[4] > 0) {
|
||||
GL.glDrawElements(GL_TRIANGLES, eb.idx[4],
|
||||
GL_UNSIGNED_SHORT, eb.off[4]);
|
||||
gl.drawElements(GL.TRIANGLES, eb.idx[4],
|
||||
GL.UNSIGNED_SHORT, eb.off[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -102,8 +93,8 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
@Override
|
||||
public void render(GLViewport v) {
|
||||
|
||||
GL.glDepthMask(true);
|
||||
GL.glClear(GL_DEPTH_BUFFER_BIT);
|
||||
gl.depthMask(true);
|
||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||
|
||||
GLState.test(true, false);
|
||||
|
||||
@ -114,18 +105,18 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
/* only use face-culling when it's unlikely
|
||||
* that one'moves through the building' */
|
||||
if (v.pos.zoomLevel < 18)
|
||||
GL.glEnable(GL_CULL_FACE);
|
||||
gl.enable(GL.CULL_FACE);
|
||||
|
||||
GL.glDepthFunc(GL_LESS);
|
||||
GL.glUniform1f(s.uAlpha, mAlpha);
|
||||
gl.depthFunc(GL.LESS);
|
||||
gl.uniform1f(s.uAlpha, mAlpha);
|
||||
|
||||
ExtrusionBuckets[] ebs = mExtrusionBucketSet;
|
||||
|
||||
if (mTranslucent) {
|
||||
/* only draw to depth buffer */
|
||||
GLState.blend(false);
|
||||
GL.glColorMask(false, false, false, false);
|
||||
GL.glUniform1i(s.uMode, -1);
|
||||
gl.colorMask(false, false, false, false);
|
||||
gl.uniform1i(s.uMode, -1);
|
||||
|
||||
for (int i = 0; i < mBucketsCnt; i++) {
|
||||
if (ebs[i].ibo == null)
|
||||
@ -141,10 +132,10 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
}
|
||||
|
||||
/* only draw to color buffer */
|
||||
GL.glColorMask(true, true, true, true);
|
||||
GL.glDepthMask(false);
|
||||
gl.colorMask(true, true, true, true);
|
||||
gl.depthMask(false);
|
||||
|
||||
GL.glDepthFunc(GL_EQUAL);
|
||||
gl.depthFunc(GL.EQUAL);
|
||||
}
|
||||
|
||||
GLState.blend(true);
|
||||
@ -174,49 +165,49 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
mMode == 0 ? 4 : 1,
|
||||
eb.colors);
|
||||
}
|
||||
GL.glVertexAttribPointer(s.aPos, 3, GL_SHORT,
|
||||
false, 8, eb.getVertexOffset());
|
||||
gl.vertexAttribPointer(s.aPos, 3, GL.SHORT,
|
||||
false, 8, eb.getVertexOffset());
|
||||
|
||||
GL.glVertexAttribPointer(s.aLight, 2, GL_UNSIGNED_BYTE,
|
||||
false, 8, eb.getVertexOffset() + 6);
|
||||
gl.vertexAttribPointer(s.aLight, 2, GL.UNSIGNED_BYTE,
|
||||
false, 8, eb.getVertexOffset() + 6);
|
||||
|
||||
/* draw extruded outlines */
|
||||
if (eb.idx[0] > 0) {
|
||||
if (mTranslucent) {
|
||||
GL.glDepthFunc(GL20.GL_EQUAL);
|
||||
gl.depthFunc(GL.EQUAL);
|
||||
setMatrix(v, ebs[i], true);
|
||||
v.mvp.setAsUniform(s.uMVP);
|
||||
}
|
||||
|
||||
/* draw roof */
|
||||
GL.glUniform1i(s.uMode, 0);
|
||||
GL.glDrawElements(GL_TRIANGLES, eb.idx[2], GL_UNSIGNED_SHORT, eb.off[2]);
|
||||
gl.uniform1i(s.uMode, 0);
|
||||
gl.drawElements(GL.TRIANGLES, eb.idx[2], GL.UNSIGNED_SHORT, eb.off[2]);
|
||||
|
||||
/* draw sides 1 */
|
||||
GL.glUniform1i(s.uMode, 1);
|
||||
GL.glDrawElements(GL_TRIANGLES, eb.idx[0], GL_UNSIGNED_SHORT, eb.off[0]);
|
||||
gl.uniform1i(s.uMode, 1);
|
||||
gl.drawElements(GL.TRIANGLES, eb.idx[0], GL.UNSIGNED_SHORT, eb.off[0]);
|
||||
|
||||
/* draw sides 2 */
|
||||
GL.glUniform1i(s.uMode, 2);
|
||||
GL.glDrawElements(GL_TRIANGLES, eb.idx[1], GL_UNSIGNED_SHORT, eb.off[1]);
|
||||
gl.uniform1i(s.uMode, 2);
|
||||
gl.drawElements(GL.TRIANGLES, eb.idx[1], GL.UNSIGNED_SHORT, eb.off[1]);
|
||||
|
||||
if (mTranslucent) {
|
||||
/* drawing gl_lines with the same coordinates does not
|
||||
* result in same depth values as polygons, so add
|
||||
* offset and draw gl_lequal: */
|
||||
GL.glDepthFunc(GL_LEQUAL);
|
||||
gl.depthFunc(GL.LEQUAL);
|
||||
v.mvp.addDepthOffset(100);
|
||||
v.mvp.setAsUniform(s.uMVP);
|
||||
}
|
||||
|
||||
GL.glUniform1i(s.uMode, 3);
|
||||
gl.uniform1i(s.uMode, 3);
|
||||
|
||||
GL.glDrawElements(GL_LINES, eb.idx[3], GL_UNSIGNED_SHORT, eb.off[3]);
|
||||
gl.drawElements(GL.LINES, eb.idx[3], GL.UNSIGNED_SHORT, eb.off[3]);
|
||||
}
|
||||
|
||||
/* draw triangle meshes */
|
||||
if (eb.idx[4] > 0) {
|
||||
GL.glDrawElements(GL_TRIANGLES, eb.idx[4], GL_UNSIGNED_SHORT, eb.off[4]);
|
||||
gl.drawElements(GL.TRIANGLES, eb.idx[4], GL.UNSIGNED_SHORT, eb.off[4]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,10 +216,10 @@ public abstract class ExtrusionRenderer extends LayerRenderer {
|
||||
}
|
||||
|
||||
if (!mTranslucent)
|
||||
GL.glDepthMask(false);
|
||||
gl.depthMask(false);
|
||||
|
||||
if (v.pos.zoomLevel < 18)
|
||||
GL.glDisable(GL_CULL_FACE);
|
||||
gl.disable(GL.CULL_FACE);
|
||||
}
|
||||
|
||||
private static void setMatrix(GLViewport v, ExtrusionBuckets l, boolean offset) {
|
||||
|
@ -16,6 +16,8 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
@ -213,7 +215,7 @@ public class GLMatrix {
|
||||
* @param location GL location id
|
||||
*/
|
||||
public void setAsUniform(int location) {
|
||||
MapRenderer.GL.glUniformMatrix4fv(location, 1, false, buffer);
|
||||
gl.uniformMatrix4fv(location, 1, false, buffer);
|
||||
//setAsUniform(pointer, location);
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.AssetAdapter;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -11,8 +13,6 @@ import org.slf4j.LoggerFactory;
|
||||
public abstract class GLShader {
|
||||
final static Logger log = LoggerFactory.getLogger(GLShader.class);
|
||||
|
||||
protected static GL20 GL;
|
||||
|
||||
public int program;
|
||||
|
||||
protected boolean create(String vertexSource, String fragmentSource) {
|
||||
@ -26,14 +26,14 @@ public abstract class GLShader {
|
||||
}
|
||||
|
||||
protected int getAttrib(String name) {
|
||||
int loc = GL.glGetAttribLocation(program, name);
|
||||
int loc = gl.getAttribLocation(program, name);
|
||||
if (loc < 0)
|
||||
log.debug("missing attribute: {}", name);
|
||||
return loc;
|
||||
}
|
||||
|
||||
protected int getUniform(String name) {
|
||||
int loc = GL.glGetUniformLocation(program, name);
|
||||
int loc = gl.getUniformLocation(program, name);
|
||||
if (loc < 0)
|
||||
log.debug("missing uniform: {}", name);
|
||||
return loc;
|
||||
@ -67,18 +67,18 @@ public abstract class GLShader {
|
||||
|
||||
public static int loadShader(int shaderType, String source) {
|
||||
|
||||
int shader = GL.glCreateShader(shaderType);
|
||||
int shader = gl.createShader(shaderType);
|
||||
if (shader != 0) {
|
||||
GL.glShaderSource(shader, source);
|
||||
GL.glCompileShader(shader);
|
||||
gl.shaderSource(shader, source);
|
||||
gl.compileShader(shader);
|
||||
IntBuffer compiled = MapRenderer.getIntBuffer(1);
|
||||
|
||||
GL.glGetShaderiv(shader, GL20.GL_COMPILE_STATUS, compiled);
|
||||
gl.getShaderiv(shader, GL.COMPILE_STATUS, compiled);
|
||||
compiled.position(0);
|
||||
if (compiled.get() == 0) {
|
||||
log.error("Could not compile shader " + shaderType + ":");
|
||||
log.error(GL.glGetShaderInfoLog(shader));
|
||||
GL.glDeleteShader(shader);
|
||||
log.error(gl.getShaderInfoLog(shader));
|
||||
gl.deleteShader(shader);
|
||||
shader = 0;
|
||||
}
|
||||
}
|
||||
@ -92,38 +92,34 @@ public abstract class GLShader {
|
||||
else
|
||||
defs += "#define GLES 1\n";
|
||||
|
||||
int vertexShader = loadShader(GL20.GL_VERTEX_SHADER, defs + vertexSource);
|
||||
int vertexShader = loadShader(GL.VERTEX_SHADER, defs + vertexSource);
|
||||
if (vertexShader == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pixelShader = loadShader(GL20.GL_FRAGMENT_SHADER, defs + fragmentSource);
|
||||
int pixelShader = loadShader(GL.FRAGMENT_SHADER, defs + fragmentSource);
|
||||
if (pixelShader == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int program = GL.glCreateProgram();
|
||||
int program = gl.createProgram();
|
||||
if (program != 0) {
|
||||
GLUtils.checkGlError("glCreateProgram");
|
||||
GL.glAttachShader(program, vertexShader);
|
||||
gl.attachShader(program, vertexShader);
|
||||
GLUtils.checkGlError("glAttachShader");
|
||||
GL.glAttachShader(program, pixelShader);
|
||||
gl.attachShader(program, pixelShader);
|
||||
GLUtils.checkGlError("glAttachShader");
|
||||
GL.glLinkProgram(program);
|
||||
gl.linkProgram(program);
|
||||
IntBuffer linkStatus = MapRenderer.getIntBuffer(1);
|
||||
GL.glGetProgramiv(program, GL20.GL_LINK_STATUS, linkStatus);
|
||||
gl.getProgramiv(program, GL.LINK_STATUS, linkStatus);
|
||||
linkStatus.position(0);
|
||||
if (linkStatus.get() != GL20.GL_TRUE) {
|
||||
if (linkStatus.get() != GL.TRUE) {
|
||||
log.error("Could not link program: ");
|
||||
log.error(GL.glGetProgramInfoLog(program));
|
||||
GL.glDeleteProgram(program);
|
||||
log.error(gl.getProgramInfoLog(program));
|
||||
gl.deleteProgram(program);
|
||||
program = 0;
|
||||
}
|
||||
}
|
||||
return program;
|
||||
}
|
||||
|
||||
public static void init(GL20 gl20) {
|
||||
GL = gl20;
|
||||
}
|
||||
}
|
||||
|
@ -16,15 +16,15 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class GLState {
|
||||
static final Logger log = LoggerFactory.getLogger(GLState.class);
|
||||
|
||||
private static GL20 GL;
|
||||
|
||||
private final static boolean[] vertexArray = { false, false };
|
||||
private static boolean blend = false;
|
||||
private static boolean depth = false;
|
||||
@ -36,9 +36,7 @@ public class GLState {
|
||||
|
||||
private static int currentTexId;
|
||||
|
||||
static void init(GL20 gl) {
|
||||
GL = gl;
|
||||
|
||||
static void init() {
|
||||
vertexArray[0] = false;
|
||||
vertexArray[1] = false;
|
||||
blend = false;
|
||||
@ -50,16 +48,16 @@ public class GLState {
|
||||
glIndexBuffer = -1;
|
||||
clearColor = null;
|
||||
|
||||
GL.glDisable(GL20.GL_STENCIL_TEST);
|
||||
GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||
GL.glDisable(GL20.GL_BLEND);
|
||||
gl.disable(GL.STENCIL_TEST);
|
||||
gl.disable(GL.DEPTH_TEST);
|
||||
gl.disable(GL.BLEND);
|
||||
}
|
||||
|
||||
public static boolean useProgram(int shaderProgram) {
|
||||
if (shaderProgram < 0) {
|
||||
shader = -1;
|
||||
} else if (shaderProgram != shader) {
|
||||
GL.glUseProgram(shaderProgram);
|
||||
gl.useProgram(shaderProgram);
|
||||
shader = shaderProgram;
|
||||
return true;
|
||||
}
|
||||
@ -71,9 +69,9 @@ public class GLState {
|
||||
return;
|
||||
|
||||
if (enable)
|
||||
GL.glEnable(GL20.GL_BLEND);
|
||||
gl.enable(GL.BLEND);
|
||||
else
|
||||
GL.glDisable(GL20.GL_BLEND);
|
||||
gl.disable(GL.BLEND);
|
||||
blend = enable;
|
||||
}
|
||||
|
||||
@ -81,9 +79,9 @@ public class GLState {
|
||||
if (depth != enable) {
|
||||
|
||||
if (enable)
|
||||
GL.glEnable(GL20.GL_DEPTH_TEST);
|
||||
gl.enable(GL.DEPTH_TEST);
|
||||
else
|
||||
GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||
gl.disable(GL.DEPTH_TEST);
|
||||
|
||||
depth = enable;
|
||||
}
|
||||
@ -93,9 +91,9 @@ public class GLState {
|
||||
if (depth != depthTest) {
|
||||
|
||||
if (depthTest)
|
||||
GL.glEnable(GL20.GL_DEPTH_TEST);
|
||||
gl.enable(GL.DEPTH_TEST);
|
||||
else
|
||||
GL.glDisable(GL20.GL_DEPTH_TEST);
|
||||
gl.disable(GL.DEPTH_TEST);
|
||||
|
||||
depth = depthTest;
|
||||
}
|
||||
@ -103,9 +101,9 @@ public class GLState {
|
||||
if (stencil != stencilTest) {
|
||||
|
||||
if (stencilTest)
|
||||
GL.glEnable(GL20.GL_STENCIL_TEST);
|
||||
gl.enable(GL.STENCIL_TEST);
|
||||
else
|
||||
GL.glDisable(GL20.GL_STENCIL_TEST);
|
||||
gl.disable(GL.STENCIL_TEST);
|
||||
|
||||
stencil = stencilTest;
|
||||
}
|
||||
@ -117,24 +115,24 @@ public class GLState {
|
||||
|
||||
if ((va1 == 0 || va2 == 0)) {
|
||||
if (!vertexArray[0]) {
|
||||
GL.glEnableVertexAttribArray(0);
|
||||
gl.enableVertexAttribArray(0);
|
||||
vertexArray[0] = true;
|
||||
}
|
||||
} else {
|
||||
if (vertexArray[0]) {
|
||||
GL.glDisableVertexAttribArray(0);
|
||||
gl.disableVertexAttribArray(0);
|
||||
vertexArray[0] = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((va1 == 1 || va2 == 1)) {
|
||||
if (!vertexArray[1]) {
|
||||
GL.glEnableVertexAttribArray(1);
|
||||
gl.enableVertexAttribArray(1);
|
||||
vertexArray[1] = true;
|
||||
}
|
||||
} else {
|
||||
if (vertexArray[1]) {
|
||||
GL.glDisableVertexAttribArray(1);
|
||||
gl.disableVertexAttribArray(1);
|
||||
vertexArray[1] = false;
|
||||
}
|
||||
}
|
||||
@ -142,10 +140,10 @@ public class GLState {
|
||||
|
||||
public static void bindTex2D(int id) {
|
||||
if (id < 0) {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
gl.bindTexture(GL.TEXTURE_2D, 0);
|
||||
currentTexId = 0;
|
||||
} else if (currentTexId != id) {
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, id);
|
||||
gl.bindTexture(GL.TEXTURE_2D, id);
|
||||
currentTexId = id;
|
||||
}
|
||||
}
|
||||
@ -159,18 +157,18 @@ public class GLState {
|
||||
return;
|
||||
|
||||
clearColor = color;
|
||||
GL.glClearColor(color[0], color[1], color[2], color[3]);
|
||||
gl.clearColor(color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
public static void bindBuffer(int target, int id) {
|
||||
//log.debug(">> buffer {} {}", target == GL20.GL_ARRAY_BUFFER, id);
|
||||
//log.debug(">> buffer {} {}", target == GL20.ARRAY_BUFFER, id);
|
||||
|
||||
if (target == GL20.GL_ARRAY_BUFFER) {
|
||||
if (target == GL.ARRAY_BUFFER) {
|
||||
if (glVertexBuffer == id)
|
||||
return;
|
||||
glVertexBuffer = id;
|
||||
}
|
||||
else if (target == GL20.GL_ELEMENT_ARRAY_BUFFER) {
|
||||
else if (target == GL.ELEMENT_ARRAY_BUFFER) {
|
||||
if (glIndexBuffer == id)
|
||||
return;
|
||||
glIndexBuffer = id;
|
||||
@ -179,10 +177,10 @@ public class GLState {
|
||||
log.debug("invalid target {}", target);
|
||||
return;
|
||||
}
|
||||
//log.debug("bind buffer {} {}", target == GL20.GL_ARRAY_BUFFER, id);
|
||||
//log.debug("bind buffer {} {}", target == GL20.ARRAY_BUFFER, id);
|
||||
|
||||
if (id >= 0)
|
||||
GL.glBindBuffer(target, id);
|
||||
gl.bindBuffer(target, id);
|
||||
}
|
||||
|
||||
public static void bindElementBuffer(int id) {
|
||||
@ -192,7 +190,7 @@ public class GLState {
|
||||
glIndexBuffer = id;
|
||||
|
||||
if (id >= 0)
|
||||
GL.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, id);
|
||||
gl.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, id);
|
||||
|
||||
}
|
||||
|
||||
@ -203,7 +201,7 @@ public class GLState {
|
||||
glVertexBuffer = id;
|
||||
|
||||
if (id >= 0)
|
||||
GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, id);
|
||||
gl.bindBuffer(GL.ARRAY_BUFFER, id);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,14 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.utils.FastMath;
|
||||
import org.slf4j.Logger;
|
||||
@ -33,12 +35,6 @@ import org.slf4j.LoggerFactory;
|
||||
public class GLUtils {
|
||||
static final Logger log = LoggerFactory.getLogger(GLUtils.class);
|
||||
|
||||
private static GL20 GL;
|
||||
|
||||
static void init(GL20 gl) {
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
public static void setColor(int location, int color, float alpha) {
|
||||
if (alpha >= 1)
|
||||
alpha = ((color >>> 24) & 0xff) / 255f;
|
||||
@ -48,46 +44,46 @@ public class GLUtils {
|
||||
alpha *= ((color >>> 24) & 0xff) / 255f;
|
||||
|
||||
if (alpha == 1) {
|
||||
GL.glUniform4f(location,
|
||||
((color >>> 16) & 0xff) / 255f,
|
||||
((color >>> 8) & 0xff) / 255f,
|
||||
((color >>> 0) & 0xff) / 255f,
|
||||
alpha);
|
||||
gl.uniform4f(location,
|
||||
((color >>> 16) & 0xff) / 255f,
|
||||
((color >>> 8) & 0xff) / 255f,
|
||||
((color >>> 0) & 0xff) / 255f,
|
||||
alpha);
|
||||
} else {
|
||||
GL.glUniform4f(location,
|
||||
((color >>> 16) & 0xff) / 255f * alpha,
|
||||
((color >>> 8) & 0xff) / 255f * alpha,
|
||||
((color >>> 0) & 0xff) / 255f * alpha,
|
||||
alpha);
|
||||
gl.uniform4f(location,
|
||||
((color >>> 16) & 0xff) / 255f * alpha,
|
||||
((color >>> 8) & 0xff) / 255f * alpha,
|
||||
((color >>> 0) & 0xff) / 255f * alpha,
|
||||
alpha);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setColorBlend(int location, int color1, int color2, float mix) {
|
||||
float a1 = (((color1 >>> 24) & 0xff) / 255f) * (1 - mix);
|
||||
float a2 = (((color2 >>> 24) & 0xff) / 255f) * mix;
|
||||
GL.glUniform4f(location,
|
||||
((((color1 >>> 16) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 16) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 8) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 8) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 0) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 0) & 0xff) / 255f) * a2),
|
||||
(a1 + a2));
|
||||
gl.uniform4f(location,
|
||||
((((color1 >>> 16) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 16) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 8) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 8) & 0xff) / 255f) * a2),
|
||||
((((color1 >>> 0) & 0xff) / 255f) * a1
|
||||
+ (((color2 >>> 0) & 0xff) / 255f) * a2),
|
||||
(a1 + a2));
|
||||
}
|
||||
|
||||
public static void setTextureParameter(int min_filter, int mag_filter, int wrap_s, int wrap_t) {
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D,
|
||||
GL20.GL_TEXTURE_MIN_FILTER,
|
||||
min_filter);
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D,
|
||||
GL20.GL_TEXTURE_MAG_FILTER,
|
||||
mag_filter);
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D,
|
||||
GL20.GL_TEXTURE_WRAP_S,
|
||||
wrap_s); // Set U Wrapping
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D,
|
||||
GL20.GL_TEXTURE_WRAP_T,
|
||||
wrap_t); // Set V Wrapping
|
||||
gl.texParameterf(GL.TEXTURE_2D,
|
||||
GL.TEXTURE_MIN_FILTER,
|
||||
min_filter);
|
||||
gl.texParameterf(GL.TEXTURE_2D,
|
||||
GL.TEXTURE_MAG_FILTER,
|
||||
mag_filter);
|
||||
gl.texParameterf(GL.TEXTURE_2D,
|
||||
GL.TEXTURE_WRAP_S,
|
||||
wrap_s); // Set U Wrapping
|
||||
gl.texParameterf(GL.TEXTURE_2D,
|
||||
GL.TEXTURE_WRAP_T,
|
||||
wrap_t); // Set V Wrapping
|
||||
}
|
||||
|
||||
public static int loadTexture(byte[] pixel, int width, int height, int format,
|
||||
@ -102,8 +98,8 @@ public class GLUtils {
|
||||
buf.put(pixel);
|
||||
buf.position(0);
|
||||
IntBuffer intBuf = buf.asIntBuffer();
|
||||
GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0, format, width, height, 0, format,
|
||||
GL20.GL_UNSIGNED_BYTE, intBuf);
|
||||
gl.texImage2D(GL.TEXTURE_2D, 0, format, width, height, 0, format,
|
||||
GL.UNSIGNED_BYTE, intBuf);
|
||||
|
||||
GLState.bindTex2D(0);
|
||||
|
||||
@ -135,18 +131,18 @@ public class GLUtils {
|
||||
pos += flip;
|
||||
}
|
||||
|
||||
return loadTexture(pixel, sum, 1, GL20.GL_ALPHA,
|
||||
GL20.GL_LINEAR, GL20.GL_LINEAR,
|
||||
return loadTexture(pixel, sum, 1, GL.ALPHA,
|
||||
GL.LINEAR, GL.LINEAR,
|
||||
// GLES20.GL_NEAREST, GLES20.GL_NEAREST,
|
||||
GL20.GL_REPEAT,
|
||||
GL20.GL_REPEAT);
|
||||
GL.REPEAT,
|
||||
GL.REPEAT);
|
||||
}
|
||||
|
||||
public static void checkGlError(String op) {
|
||||
//GL = GLAdapter.get();
|
||||
|
||||
int error;
|
||||
while ((error = GL.glGetError()) != 0) { // GL20.GL_NO_ERROR) {
|
||||
while ((error = gl.getError()) != 0) { // GL20.NO_ERROR) {
|
||||
log.error(op + ": glError " + error);
|
||||
// throw new RuntimeException(op + ": glError " + error);
|
||||
}
|
||||
@ -155,7 +151,7 @@ public class GLUtils {
|
||||
public static boolean checkGlOutOfMemory(String op) {
|
||||
int error;
|
||||
boolean oom = false;
|
||||
while ((error = GL.glGetError()) != 0) {// GL20.GL_NO_ERROR) {
|
||||
while ((error = gl.getError()) != 0) {// GL20.NO_ERROR) {
|
||||
log.error(op + ": glError " + error);
|
||||
// throw new RuntimeException(op + ": glError " + error);
|
||||
if (error == 1285)
|
||||
@ -166,17 +162,17 @@ public class GLUtils {
|
||||
|
||||
public static void setColor(int handle, float[] c, float alpha) {
|
||||
if (alpha >= 1) {
|
||||
GL.glUniform4f(handle, c[0], c[1], c[2], c[3]);
|
||||
gl.uniform4f(handle, c[0], c[1], c[2], c[3]);
|
||||
} else {
|
||||
if (alpha < 0) {
|
||||
log.debug("setColor: " + alpha);
|
||||
alpha = 0;
|
||||
GL.glUniform4f(handle, 0, 0, 0, 0);
|
||||
gl.uniform4f(handle, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
GL.glUniform4f(handle,
|
||||
c[0] * alpha, c[1] * alpha,
|
||||
c[2] * alpha, c[3] * alpha);
|
||||
gl.uniform4f(handle,
|
||||
c[0] * alpha, c[1] * alpha,
|
||||
c[2] * alpha, c[3] * alpha);
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,14 +221,14 @@ public class GLUtils {
|
||||
FloatBuffer buf = MapRenderer.getFloatBuffer(count * 4);
|
||||
buf.put(val);
|
||||
buf.flip();
|
||||
GL.glUniform4fv(location, count, buf);
|
||||
gl.uniform4fv(location, count, buf);
|
||||
}
|
||||
|
||||
public static int[] glGenBuffers(int num) {
|
||||
IntBuffer buf = MapRenderer.getIntBuffer(num);
|
||||
buf.position(0);
|
||||
buf.limit(num);
|
||||
GL.glGenBuffers(num, buf);
|
||||
gl.genBuffers(num, buf);
|
||||
int[] ret = new int[num];
|
||||
buf.position(0);
|
||||
buf.limit(num);
|
||||
@ -244,7 +240,7 @@ public class GLUtils {
|
||||
IntBuffer buf = MapRenderer.getIntBuffer(num);
|
||||
buf.put(ids, 0, num);
|
||||
buf.flip();
|
||||
GL.glDeleteBuffers(num, buf);
|
||||
gl.deleteBuffers(num, buf);
|
||||
}
|
||||
|
||||
public static int[] glGenTextures(int num) {
|
||||
@ -256,13 +252,13 @@ public class GLUtils {
|
||||
|
||||
if (GLAdapter.GDX_WEBGL_QUIRKS) {
|
||||
for (int i = 0; i < num; i++) {
|
||||
GL.glGenTextures(num, buf);
|
||||
gl.genTextures(num, buf);
|
||||
buf.position(0);
|
||||
ret[i] = buf.get();
|
||||
buf.position(0);
|
||||
}
|
||||
} else {
|
||||
GL.glGenTextures(num, buf);
|
||||
gl.genTextures(num, buf);
|
||||
buf.position(0);
|
||||
buf.get(ret);
|
||||
}
|
||||
@ -274,6 +270,6 @@ public class GLUtils {
|
||||
IntBuffer buf = MapRenderer.getIntBuffer(num);
|
||||
buf.put(ids, 0, num);
|
||||
buf.flip();
|
||||
GL.glDeleteTextures(num, buf);
|
||||
gl.deleteTextures(num, buf);
|
||||
}
|
||||
}
|
||||
|
@ -16,16 +16,8 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
|
||||
public abstract class LayerRenderer {
|
||||
|
||||
protected static GL20 GL;
|
||||
|
||||
static void init(GL20 gl) {
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
/** flag to set when layer is ready for rendering */
|
||||
boolean isReady;
|
||||
|
||||
|
@ -16,11 +16,13 @@
|
||||
*/
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.map.Map;
|
||||
@ -32,8 +34,6 @@ import org.slf4j.LoggerFactory;
|
||||
public class MapRenderer {
|
||||
static final Logger log = LoggerFactory.getLogger(MapRenderer.class);
|
||||
|
||||
static GL20 GL;
|
||||
|
||||
/** scale factor used for short vertices */
|
||||
public static final float COORD_SCALE = 8.0f;
|
||||
|
||||
@ -81,15 +81,15 @@ public class MapRenderer {
|
||||
private void draw() {
|
||||
GLState.setClearColor(mClearColor);
|
||||
|
||||
GL.glDepthMask(true);
|
||||
GL.glStencilMask(0xFF);
|
||||
gl.depthMask(true);
|
||||
gl.stencilMask(0xFF);
|
||||
|
||||
GL.glClear(GL20.GL_COLOR_BUFFER_BIT
|
||||
| GL20.GL_DEPTH_BUFFER_BIT
|
||||
| GL20.GL_STENCIL_BUFFER_BIT);
|
||||
gl.clear(GL.COLOR_BUFFER_BIT
|
||||
| GL.DEPTH_BUFFER_BIT
|
||||
| GL.STENCIL_BUFFER_BIT);
|
||||
|
||||
GL.glDepthMask(false);
|
||||
GL.glStencilMask(0);
|
||||
gl.depthMask(false);
|
||||
gl.stencilMask(0);
|
||||
|
||||
GLState.test(false, false);
|
||||
GLState.blend(false);
|
||||
@ -147,18 +147,18 @@ public class MapRenderer {
|
||||
|
||||
//mMap.viewport().getMatrix(null, mMatrices.proj, null);
|
||||
mViewport.initFrom(mMap.viewport());
|
||||
GL.glViewport(0, 0, width, height);
|
||||
gl.viewport(0, 0, width, height);
|
||||
|
||||
//GL.glScissor(0, 0, width, height);
|
||||
//GL.glEnable(GL20.GL_SCISSOR_TEST);
|
||||
//GL.scissor(0, 0, width, height);
|
||||
//GL.enable(GL20.SCISSOR_TEST);
|
||||
|
||||
GL.glClearStencil(0x00);
|
||||
gl.clearStencil(0x00);
|
||||
|
||||
GL.glDisable(GL20.GL_CULL_FACE);
|
||||
GL.glBlendFunc(GL20.GL_ONE, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl.disable(GL.CULL_FACE);
|
||||
gl.blendFunc(GL.ONE, GL.ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
GL.glFrontFace(GL20.GL_CW);
|
||||
GL.glCullFace(GL20.GL_BACK);
|
||||
gl.frontFace(GL.CW);
|
||||
gl.cullFace(GL.BACK);
|
||||
|
||||
if (!mNewSurface) {
|
||||
mMap.updateMap(false);
|
||||
@ -187,9 +187,9 @@ public class MapRenderer {
|
||||
buf.flip();
|
||||
|
||||
GLState.bindElementBuffer(mQuadIndicesID);
|
||||
GL.glBufferData(GL20.GL_ELEMENT_ARRAY_BUFFER,
|
||||
indices.length * 2, buf,
|
||||
GL20.GL_STATIC_DRAW);
|
||||
gl.bufferData(GL.ELEMENT_ARRAY_BUFFER,
|
||||
indices.length * 2, buf,
|
||||
GL.STATIC_DRAW);
|
||||
GLState.bindElementBuffer(0);
|
||||
|
||||
/** initialize default quad */
|
||||
@ -200,22 +200,21 @@ public class MapRenderer {
|
||||
mQuadVerticesID = vboIds[1];
|
||||
|
||||
GLState.bindVertexBuffer(mQuadVerticesID);
|
||||
GL.glBufferData(GL20.GL_ARRAY_BUFFER,
|
||||
quad.length * 4, floatBuffer,
|
||||
GL20.GL_STATIC_DRAW);
|
||||
gl.bufferData(GL.ARRAY_BUFFER,
|
||||
quad.length * 4, floatBuffer,
|
||||
GL.STATIC_DRAW);
|
||||
GLState.bindVertexBuffer(0);
|
||||
|
||||
GLState.init(GL);
|
||||
GLState.init();
|
||||
|
||||
mMap.updateMap(true);
|
||||
}
|
||||
|
||||
public void onSurfaceCreated() {
|
||||
GL = GLAdapter.get();
|
||||
// log.debug(GL.glGetString(GL20.GL_EXTENSIONS));
|
||||
String vendor = GL.glGetString(GL20.GL_VENDOR);
|
||||
String renderer = GL.glGetString(GL20.GL_RENDERER);
|
||||
String version = GL.glGetString(GL20.GL_VERSION);
|
||||
// log.debug(GL.getString(GL20.EXTENSIONS));
|
||||
String vendor = gl.getString(GL.VENDOR);
|
||||
String renderer = gl.getString(GL.RENDERER);
|
||||
String version = gl.getString(GL.VERSION);
|
||||
log.debug("{}/{}/{}", vendor, renderer, version);
|
||||
|
||||
if ("Adreno (TM) 330".equals(renderer) || "Adreno (TM) 320".equals(renderer)) {
|
||||
@ -223,17 +222,13 @@ public class MapRenderer {
|
||||
GLAdapter.NO_BUFFER_SUB_DATA = true;
|
||||
}
|
||||
|
||||
GLState.init(GL);
|
||||
GLUtils.init(GL);
|
||||
GLShader.init(GL);
|
||||
OffscreenRenderer.init(GL);
|
||||
GLState.init();
|
||||
|
||||
// Set up some vertex buffer objects
|
||||
BufferObject.init(GL, 200);
|
||||
BufferObject.init(200);
|
||||
|
||||
// classes that require GL context for initialization
|
||||
RenderBuckets.initRenderer(GL);
|
||||
LayerRenderer.init(GL);
|
||||
RenderBuckets.initRenderer();
|
||||
|
||||
mNewSurface = true;
|
||||
}
|
||||
@ -244,14 +239,14 @@ public class MapRenderer {
|
||||
* Bind VBO for a simple quad. Handy for simple custom RenderLayers
|
||||
* Vertices: float[]{ -1, -1, -1, 1, 1, -1, 1, 1 }
|
||||
*
|
||||
* GL.glDrawArrays(GL20.GL_TRIANGLE_STRIP, 0, 4);
|
||||
* GL.drawArrays(GL20.TRIANGLE_STRIP, 0, 4);
|
||||
*/
|
||||
public static void bindQuadVertexVBO(int location) {
|
||||
|
||||
if (location >= 0) {
|
||||
GLState.bindVertexBuffer(mQuadVerticesID);
|
||||
GLState.enableVertexArrays(location, -1);
|
||||
GL.glVertexAttribPointer(location, 2, GL20.GL_FLOAT, false, 0, 0);
|
||||
gl.vertexAttribPointer(location, 2, GL.FLOAT, false, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
package org.oscim.renderer;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@ -57,103 +59,99 @@ public class OffscreenRenderer extends LayerRenderer {
|
||||
texW = (int) viewport.getWidth();
|
||||
texH = (int) viewport.getHeight();
|
||||
|
||||
GL.glGenFramebuffers(1, buf);
|
||||
gl.genFramebuffers(1, buf);
|
||||
fb = buf.get(0);
|
||||
|
||||
buf.clear();
|
||||
GL.glGenTextures(1, buf);
|
||||
gl.genTextures(1, buf);
|
||||
renderTex = buf.get(0);
|
||||
|
||||
GLUtils.checkGlError("0");
|
||||
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fb);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, fb);
|
||||
|
||||
// generate color texture
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, renderTex);
|
||||
gl.bindTexture(GL.TEXTURE_2D, renderTex);
|
||||
|
||||
GLUtils.setTextureParameter(
|
||||
GL20.GL_LINEAR,
|
||||
GL20.GL_LINEAR,
|
||||
//GL20.GL_NEAREST,
|
||||
//GL20.GL_NEAREST,
|
||||
GL20.GL_CLAMP_TO_EDGE,
|
||||
GL20.GL_CLAMP_TO_EDGE);
|
||||
GL.LINEAR,
|
||||
GL.LINEAR,
|
||||
//GL20.NEAREST,
|
||||
//GL20.NEAREST,
|
||||
GL.CLAMP_TO_EDGE,
|
||||
GL.CLAMP_TO_EDGE);
|
||||
|
||||
GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0,
|
||||
GL20.GL_RGBA, texW, texH, 0, GL20.GL_RGBA,
|
||||
GL20.GL_UNSIGNED_BYTE, null);
|
||||
gl.texImage2D(GL.TEXTURE_2D, 0,
|
||||
GL.RGBA, texW, texH, 0, GL.RGBA,
|
||||
GL.UNSIGNED_BYTE, null);
|
||||
|
||||
GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER,
|
||||
GL20.GL_COLOR_ATTACHMENT0,
|
||||
GL20.GL_TEXTURE_2D,
|
||||
renderTex, 0);
|
||||
gl.framebufferTexture2D(GL.FRAMEBUFFER,
|
||||
GL.COLOR_ATTACHMENT0,
|
||||
GL.TEXTURE_2D,
|
||||
renderTex, 0);
|
||||
GLUtils.checkGlError("1");
|
||||
|
||||
if (useDepthTexture) {
|
||||
buf.clear();
|
||||
GL.glGenTextures(1, buf);
|
||||
gl.genTextures(1, buf);
|
||||
renderDepth = buf.get(0);
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, renderDepth);
|
||||
GLUtils.setTextureParameter(GL20.GL_NEAREST,
|
||||
GL20.GL_NEAREST,
|
||||
GL20.GL_CLAMP_TO_EDGE,
|
||||
GL20.GL_CLAMP_TO_EDGE);
|
||||
gl.bindTexture(GL.TEXTURE_2D, renderDepth);
|
||||
GLUtils.setTextureParameter(GL.NEAREST,
|
||||
GL.NEAREST,
|
||||
GL.CLAMP_TO_EDGE,
|
||||
GL.CLAMP_TO_EDGE);
|
||||
|
||||
GL.glTexImage2D(GL20.GL_TEXTURE_2D, 0,
|
||||
GL20.GL_DEPTH_COMPONENT,
|
||||
texW, texH, 0,
|
||||
GL20.GL_DEPTH_COMPONENT,
|
||||
GL20.GL_UNSIGNED_SHORT, null);
|
||||
gl.texImage2D(GL.TEXTURE_2D, 0,
|
||||
GL.DEPTH_COMPONENT,
|
||||
texW, texH, 0,
|
||||
GL.DEPTH_COMPONENT,
|
||||
GL.UNSIGNED_SHORT, null);
|
||||
|
||||
GL.glFramebufferTexture2D(GL20.GL_FRAMEBUFFER,
|
||||
GL20.GL_DEPTH_ATTACHMENT,
|
||||
GL20.GL_TEXTURE_2D,
|
||||
renderDepth, 0);
|
||||
gl.framebufferTexture2D(GL.FRAMEBUFFER,
|
||||
GL.DEPTH_ATTACHMENT,
|
||||
GL.TEXTURE_2D,
|
||||
renderDepth, 0);
|
||||
} else {
|
||||
buf.clear();
|
||||
GL.glGenRenderbuffers(1, buf);
|
||||
gl.genRenderbuffers(1, buf);
|
||||
int depthRenderbuffer = buf.get(0);
|
||||
|
||||
GL.glBindRenderbuffer(GL20.GL_RENDERBUFFER, depthRenderbuffer);
|
||||
gl.bindRenderbuffer(GL.RENDERBUFFER, depthRenderbuffer);
|
||||
|
||||
GL.glRenderbufferStorage(GL20.GL_RENDERBUFFER,
|
||||
GL20.GL_DEPTH_COMPONENT16,
|
||||
texW, texH);
|
||||
gl.renderbufferStorage(GL.RENDERBUFFER,
|
||||
GL.DEPTH_COMPONENT16,
|
||||
texW, texH);
|
||||
|
||||
GL.glFramebufferRenderbuffer(GL20.GL_FRAMEBUFFER,
|
||||
GL20.GL_DEPTH_ATTACHMENT,
|
||||
GL20.GL_RENDERBUFFER,
|
||||
depthRenderbuffer);
|
||||
gl.framebufferRenderbuffer(GL.FRAMEBUFFER,
|
||||
GL.DEPTH_ATTACHMENT,
|
||||
GL.RENDERBUFFER,
|
||||
depthRenderbuffer);
|
||||
}
|
||||
|
||||
GLUtils.checkGlError("2");
|
||||
|
||||
int status = GL.glCheckFramebufferStatus(GL20.GL_FRAMEBUFFER);
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
|
||||
GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
int status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, 0);
|
||||
gl.bindTexture(GL.TEXTURE_2D, 0);
|
||||
|
||||
if (status != GL20.GL_FRAMEBUFFER_COMPLETE) {
|
||||
if (status != GL.FRAMEBUFFER_COMPLETE) {
|
||||
log.debug("invalid framebuffer! " + status);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void init(GL20 gl20) {
|
||||
GL = gl20;
|
||||
}
|
||||
|
||||
public void enable(boolean on) {
|
||||
if (on)
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fb);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, fb);
|
||||
else
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
public void begin() {
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fb);
|
||||
GL.glDepthMask(true);
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, fb);
|
||||
gl.depthMask(true);
|
||||
gl.clear(GL.DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
LayerRenderer mRenderer;
|
||||
@ -193,38 +191,38 @@ public class OffscreenRenderer extends LayerRenderer {
|
||||
|
||||
@Override
|
||||
public void render(GLViewport viewport) {
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, fb);
|
||||
GL.glViewport(0, 0, texW, texH);
|
||||
GL.glDepthMask(true);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, fb);
|
||||
gl.viewport(0, 0, texW, texH);
|
||||
gl.depthMask(true);
|
||||
GLState.setClearColor(mClearColor);
|
||||
GL.glClear(GL20.GL_DEPTH_BUFFER_BIT | GL20.GL_COLOR_BUFFER_BIT);
|
||||
gl.clear(GL.DEPTH_BUFFER_BIT | GL.COLOR_BUFFER_BIT);
|
||||
|
||||
mRenderer.render(viewport);
|
||||
|
||||
GL.glBindFramebuffer(GL20.GL_FRAMEBUFFER, 0);
|
||||
gl.bindFramebuffer(GL.FRAMEBUFFER, 0);
|
||||
|
||||
mShader.useProgram();
|
||||
|
||||
/* bind depth texture */
|
||||
if (useDepthTexture) {
|
||||
GL.glActiveTexture(GL20.GL_TEXTURE1);
|
||||
gl.activeTexture(GL.TEXTURE1);
|
||||
GLState.bindTex2D(renderDepth);
|
||||
GL.glUniform1i(mShader.uTexDepth, 1);
|
||||
GL.glActiveTexture(GL20.GL_TEXTURE0);
|
||||
gl.uniform1i(mShader.uTexDepth, 1);
|
||||
gl.activeTexture(GL.TEXTURE0);
|
||||
}
|
||||
/* bind color texture */
|
||||
GLState.bindTex2D(renderTex);
|
||||
GL.glUniform1i(mShader.uTexColor, 0);
|
||||
gl.uniform1i(mShader.uTexColor, 0);
|
||||
|
||||
MapRenderer.bindQuadVertexVBO(mShader.aPos);
|
||||
|
||||
GL.glUniform2f(mShader.uPixel,
|
||||
(float) (1.0 / texW * 0.5),
|
||||
(float) (1.0 / texH * 0.5));
|
||||
gl.uniform2f(mShader.uPixel,
|
||||
(float) (1.0 / texW * 0.5),
|
||||
(float) (1.0 / texH * 0.5));
|
||||
|
||||
GLState.test(false, false);
|
||||
GLState.blend(true);
|
||||
GL.glDrawArrays(GL20.GL_TRIANGLE_STRIP, 0, 4);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
|
||||
GLUtils.checkGlError("....");
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLES;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_SHORT;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.renderer.MapRenderer.MAX_INDICES;
|
||||
import static org.oscim.renderer.MapRenderer.bindQuadIndicesVBO;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.renderer.GLShader;
|
||||
import org.oscim.renderer.GLState;
|
||||
@ -206,7 +205,7 @@ public class BitmapBucket extends TextureBucket {
|
||||
|
||||
TextureBucket tb = (TextureBucket) b;
|
||||
|
||||
GL.glUniform1f(s.uAlpha, alpha);
|
||||
gl.uniform1f(s.uAlpha, alpha);
|
||||
v.mvp.setAsUniform(s.uMVP);
|
||||
|
||||
bindQuadIndicesVBO();
|
||||
@ -219,18 +218,18 @@ public class BitmapBucket extends TextureBucket {
|
||||
* 2(short-bytes) / 6(indices) == 8) */
|
||||
int off = (t.offset + i) * 8 + tb.vertexOffset;
|
||||
|
||||
GL.glVertexAttribPointer(s.aPos, 2,
|
||||
GL_SHORT, false, 12, off);
|
||||
gl.vertexAttribPointer(s.aPos, 2,
|
||||
GL.SHORT, false, 12, off);
|
||||
|
||||
GL.glVertexAttribPointer(s.aTexCoord, 2,
|
||||
GL_SHORT, false, 12, off + 8);
|
||||
gl.vertexAttribPointer(s.aTexCoord, 2,
|
||||
GL.SHORT, false, 12, off + 8);
|
||||
|
||||
int numIndices = t.indices - i;
|
||||
if (numIndices > MAX_INDICES)
|
||||
numIndices = MAX_INDICES;
|
||||
|
||||
GL.glDrawElements(GL_TRIANGLES, numIndices,
|
||||
GL_UNSIGNED_SHORT, 0);
|
||||
gl.drawElements(GL.TRIANGLES, numIndices,
|
||||
GL.UNSIGNED_SHORT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ package org.oscim.renderer.bucket;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.layers.tile.MapTile;
|
||||
import org.oscim.layers.tile.MapTile.TileData;
|
||||
import org.oscim.renderer.BufferObject;
|
||||
@ -88,7 +88,7 @@ public class ExtrusionBuckets extends TileData {
|
||||
log.error("invalid indice size: {} {}", sumIndices, pos);
|
||||
size = pos * 2;
|
||||
}
|
||||
ibo = BufferObject.get(GL20.GL_ELEMENT_ARRAY_BUFFER, size);
|
||||
ibo = BufferObject.get(GL.ELEMENT_ARRAY_BUFFER, size);
|
||||
ibo.loadBufferData(iboData.flip(), size);
|
||||
|
||||
size = sumVertices * 4 * 2;
|
||||
@ -98,7 +98,7 @@ public class ExtrusionBuckets extends TileData {
|
||||
size = pos * 2;
|
||||
}
|
||||
|
||||
vbo = BufferObject.get(GL20.GL_ARRAY_BUFFER, size);
|
||||
vbo = BufferObject.get(GL.ARRAY_BUFFER, size);
|
||||
vbo.loadBufferData(vboData.flip(), size);
|
||||
|
||||
compiled = true;
|
||||
|
@ -1,10 +1,9 @@
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_LINES;
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_SHORT;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.renderer.MapRenderer.COORD_SCALE;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.renderer.GLShader;
|
||||
import org.oscim.renderer.GLState;
|
||||
@ -106,9 +105,9 @@ public class HairLineBucket extends RenderBucket {
|
||||
|
||||
v.mvp.setAsUniform(uMVP);
|
||||
|
||||
GL.glUniform2f(uScreen, v.getWidth() / 2, v.getHeight() / 2);
|
||||
GL.glUniform1f(uWidth, 1.5f);
|
||||
GL.glLineWidth(2);
|
||||
gl.uniform2f(uScreen, v.getWidth() / 2, v.getHeight() / 2);
|
||||
gl.uniform1f(uWidth, 1.5f);
|
||||
gl.lineWidth(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -124,15 +123,15 @@ public class HairLineBucket extends RenderBucket {
|
||||
|
||||
GLUtils.setColor(s.uColor, ll.line.color, 1);
|
||||
|
||||
GL.glVertexAttribPointer(s.aPos, 2, GL_SHORT,
|
||||
false, 0, ll.vertexOffset);
|
||||
gl.vertexAttribPointer(s.aPos, 2, GL.SHORT,
|
||||
false, 0, ll.vertexOffset);
|
||||
|
||||
GL.glDrawElements(GL_LINES,
|
||||
ll.numIndices,
|
||||
GL_UNSIGNED_SHORT,
|
||||
ll.indiceOffset);
|
||||
gl.drawElements(GL.LINES,
|
||||
ll.numIndices,
|
||||
GL.UNSIGNED_SHORT,
|
||||
ll.indiceOffset);
|
||||
}
|
||||
//GL.glLineWidth(1);
|
||||
//GL.lineWidth(1);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
@ -16,10 +16,9 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLE_STRIP;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.GLAdapter;
|
||||
import org.oscim.backend.canvas.Paint.Cap;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
@ -561,10 +560,10 @@ public final class LineBucket extends RenderBucket {
|
||||
}
|
||||
}
|
||||
|
||||
mTexID = GLUtils.loadTexture(pixel, 128, 128, GL20.GL_ALPHA,
|
||||
GL20.GL_NEAREST, GL20.GL_NEAREST,
|
||||
GL20.GL_MIRRORED_REPEAT,
|
||||
GL20.GL_MIRRORED_REPEAT);
|
||||
mTexID = GLUtils.loadTexture(pixel, 128, 128, GL.ALPHA,
|
||||
GL.NEAREST, GL.NEAREST,
|
||||
GL.MIRRORED_REPEAT,
|
||||
GL.MIRRORED_REPEAT);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -593,8 +592,8 @@ public final class LineBucket extends RenderBucket {
|
||||
int uLineWidth = s.uWidth;
|
||||
int uLineHeight = s.uHeight;
|
||||
|
||||
GL.glVertexAttribPointer(s.aPos, 4, GL_SHORT, false, 0,
|
||||
buckets.offset[LINE]);
|
||||
gl.vertexAttribPointer(s.aPos, 4, GL.SHORT, false, 0,
|
||||
buckets.offset[LINE]);
|
||||
|
||||
v.mvp.setAsUniform(s.uMVP);
|
||||
|
||||
@ -608,16 +607,16 @@ public final class LineBucket extends RenderBucket {
|
||||
* used with orthographic projection, (shader mode == 1) */
|
||||
double pixel = (mode == SHADER_PROJ) ? 0.0001 : 1.5 / scale;
|
||||
|
||||
GL.glUniform1f(uLineFade, (float) pixel);
|
||||
gl.uniform1f(uLineFade, (float) pixel);
|
||||
|
||||
int capMode = 0;
|
||||
GL.glUniform1f(uLineMode, capMode);
|
||||
gl.uniform1f(uLineMode, capMode);
|
||||
|
||||
boolean blur = false;
|
||||
double width;
|
||||
|
||||
float heightOffset = 0;
|
||||
GL.glUniform1f(uLineHeight, heightOffset);
|
||||
gl.uniform1f(uLineHeight, heightOffset);
|
||||
|
||||
for (; b != null && b.type == RenderBucket.LINE; b = b.next) {
|
||||
LineBucket lb = (LineBucket) b;
|
||||
@ -626,7 +625,7 @@ public final class LineBucket extends RenderBucket {
|
||||
if (lb.heightOffset != heightOffset) {
|
||||
heightOffset = lb.heightOffset;
|
||||
|
||||
GL.glUniform1f(uLineHeight, heightOffset /
|
||||
gl.uniform1f(uLineHeight, heightOffset /
|
||||
MercatorProjection.groundResolution(v.pos));
|
||||
}
|
||||
|
||||
@ -640,7 +639,7 @@ public final class LineBucket extends RenderBucket {
|
||||
}
|
||||
|
||||
if (mode == SHADER_PROJ && blur && line.blur == 0) {
|
||||
GL.glUniform1f(uLineFade, (float) pixel);
|
||||
gl.uniform1f(uLineFade, (float) pixel);
|
||||
blur = false;
|
||||
}
|
||||
|
||||
@ -654,16 +653,16 @@ public final class LineBucket extends RenderBucket {
|
||||
width = lb.scale * line.width / variableScale;
|
||||
}
|
||||
|
||||
GL.glUniform1f(uLineWidth,
|
||||
(float) (width * COORD_SCALE_BY_DIR_SCALE));
|
||||
gl.uniform1f(uLineWidth,
|
||||
(float) (width * COORD_SCALE_BY_DIR_SCALE));
|
||||
|
||||
/* Line-edge fade */
|
||||
if (line.blur > 0) {
|
||||
GL.glUniform1f(uLineFade, line.blur);
|
||||
gl.uniform1f(uLineFade, line.blur);
|
||||
blur = true;
|
||||
} else if (mode == SHADER_FLAT) {
|
||||
GL.glUniform1f(uLineFade, (float) (pixel / width));
|
||||
//GL.glUniform1f(uLineScale, (float)(pixel / (ll.width / s)));
|
||||
gl.uniform1f(uLineFade, (float) (pixel / width));
|
||||
//GL.uniform1f(uLineScale, (float)(pixel / (ll.width / s)));
|
||||
}
|
||||
|
||||
/* Cap mode */
|
||||
@ -671,20 +670,20 @@ public final class LineBucket extends RenderBucket {
|
||||
|
||||
if (capMode != CAP_THIN) {
|
||||
capMode = CAP_THIN;
|
||||
GL.glUniform1f(uLineMode, capMode);
|
||||
gl.uniform1f(uLineMode, capMode);
|
||||
}
|
||||
} else if (lb.roundCap) {
|
||||
if (capMode != CAP_ROUND) {
|
||||
capMode = CAP_ROUND;
|
||||
GL.glUniform1f(uLineMode, capMode);
|
||||
gl.uniform1f(uLineMode, capMode);
|
||||
}
|
||||
} else if (capMode != CAP_BUTT) {
|
||||
capMode = CAP_BUTT;
|
||||
GL.glUniform1f(uLineMode, capMode);
|
||||
gl.uniform1f(uLineMode, capMode);
|
||||
}
|
||||
|
||||
GL.glDrawArrays(GL_TRIANGLE_STRIP,
|
||||
b.vertexOffset, b.numVertices);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP,
|
||||
b.vertexOffset, b.numVertices);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -707,15 +706,15 @@ public final class LineBucket extends RenderBucket {
|
||||
width += lb.scale * line.width / variableScale;
|
||||
}
|
||||
|
||||
GL.glUniform1f(uLineWidth,
|
||||
(float) (width * COORD_SCALE_BY_DIR_SCALE));
|
||||
gl.uniform1f(uLineWidth,
|
||||
(float) (width * COORD_SCALE_BY_DIR_SCALE));
|
||||
|
||||
/* Line-edge fade */
|
||||
if (line.blur > 0) {
|
||||
GL.glUniform1f(uLineFade, line.blur);
|
||||
gl.uniform1f(uLineFade, line.blur);
|
||||
blur = true;
|
||||
} else if (mode == SHADER_FLAT) {
|
||||
GL.glUniform1f(uLineFade, (float) (pixel / width));
|
||||
gl.uniform1f(uLineFade, (float) (pixel / width));
|
||||
}
|
||||
|
||||
/* Cap mode */
|
||||
@ -723,15 +722,15 @@ public final class LineBucket extends RenderBucket {
|
||||
|
||||
if (capMode != CAP_ROUND) {
|
||||
capMode = CAP_ROUND;
|
||||
GL.glUniform1f(uLineMode, capMode);
|
||||
gl.uniform1f(uLineMode, capMode);
|
||||
}
|
||||
} else if (capMode != CAP_BUTT) {
|
||||
capMode = CAP_BUTT;
|
||||
GL.glUniform1f(uLineMode, capMode);
|
||||
gl.uniform1f(uLineMode, capMode);
|
||||
}
|
||||
|
||||
GL.glDrawArrays(GL_TRIANGLE_STRIP,
|
||||
ref.vertexOffset, ref.numVertices);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP,
|
||||
ref.vertexOffset, ref.numVertices);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.renderer.MapRenderer.MAX_INDICES;
|
||||
import static org.oscim.renderer.MapRenderer.bindQuadIndicesVBO;
|
||||
|
||||
@ -23,7 +24,7 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.renderer.GLShader;
|
||||
import org.oscim.renderer.GLState;
|
||||
@ -287,10 +288,10 @@ public final class LineTexBucket extends RenderBucket {
|
||||
|
||||
ShortBuffer sbuf = buf.asShortBuffer();
|
||||
|
||||
//GL.glBindBuffer(GL20.GL_ARRAY_BUFFER, mVertexFlipID);
|
||||
//GL.bindBuffer(GL20.ARRAY_BUFFER, mVertexFlipID);
|
||||
GLState.bindVertexBuffer(mVertexFlipID);
|
||||
GL.glBufferData(GL20.GL_ARRAY_BUFFER, flip.length, sbuf,
|
||||
GL20.GL_STATIC_DRAW);
|
||||
gl.bufferData(GL.ARRAY_BUFFER, flip.length, sbuf,
|
||||
GL.STATIC_DRAW);
|
||||
GLState.bindVertexBuffer(0);
|
||||
|
||||
// mTexID = new int[10];
|
||||
@ -321,19 +322,19 @@ public final class LineTexBucket extends RenderBucket {
|
||||
int aPos1 = shader.aPos1;
|
||||
int aFlip = shader.aFlip;
|
||||
|
||||
GL.glEnableVertexAttribArray(aPos0);
|
||||
GL.glEnableVertexAttribArray(aPos1);
|
||||
GL.glEnableVertexAttribArray(aLen0);
|
||||
GL.glEnableVertexAttribArray(aLen1);
|
||||
GL.glEnableVertexAttribArray(aFlip);
|
||||
gl.enableVertexAttribArray(aPos0);
|
||||
gl.enableVertexAttribArray(aPos1);
|
||||
gl.enableVertexAttribArray(aLen0);
|
||||
gl.enableVertexAttribArray(aLen1);
|
||||
gl.enableVertexAttribArray(aFlip);
|
||||
|
||||
v.mvp.setAsUniform(shader.uMVP);
|
||||
|
||||
bindQuadIndicesVBO();
|
||||
|
||||
GLState.bindVertexBuffer(mVertexFlipID);
|
||||
GL.glVertexAttribPointer(shader.aFlip, 1,
|
||||
GL20.GL_BYTE, false, 0, 0);
|
||||
gl.vertexAttribPointer(shader.aFlip, 1,
|
||||
GL.BYTE, false, 0, 0);
|
||||
|
||||
buckets.vbo.bind();
|
||||
|
||||
@ -341,7 +342,7 @@ public final class LineTexBucket extends RenderBucket {
|
||||
|
||||
float s = scale / div;
|
||||
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, mTexID[0]);
|
||||
//GL.bindTexture(GL20.TEXTURE_2D, mTexID[0]);
|
||||
|
||||
for (; b != null && b.type == TEXLINE; b = b.next) {
|
||||
LineTexBucket lb = (LineTexBucket) b;
|
||||
@ -354,14 +355,14 @@ public final class LineTexBucket extends RenderBucket {
|
||||
if (pScale < 1)
|
||||
pScale = 1;
|
||||
|
||||
GL.glUniform1f(shader.uPatternScale,
|
||||
(MapRenderer.COORD_SCALE * line.stipple) / pScale);
|
||||
gl.uniform1f(shader.uPatternScale,
|
||||
(MapRenderer.COORD_SCALE * line.stipple) / pScale);
|
||||
|
||||
GL.glUniform1f(shader.uPatternWidth, line.stippleWidth);
|
||||
//GL.glUniform1f(hScale, scale);
|
||||
gl.uniform1f(shader.uPatternWidth, line.stippleWidth);
|
||||
//GL.uniform1f(hScale, scale);
|
||||
|
||||
/* keep line width fixed */
|
||||
GL.glUniform1f(shader.uWidth, lb.width / s * COORD_SCALE_BY_DIR_SCALE);
|
||||
gl.uniform1f(shader.uWidth, lb.width / s * COORD_SCALE_BY_DIR_SCALE);
|
||||
|
||||
/* add offset vertex */
|
||||
int vOffset = -STRIDE;
|
||||
@ -377,20 +378,20 @@ public final class LineTexBucket extends RenderBucket {
|
||||
/* i / 6 * (24 shorts per block * 2 short bytes) */
|
||||
int add = (b.vertexOffset + i * 8) + vOffset;
|
||||
|
||||
GL.glVertexAttribPointer(aPos0, 4, GL20.GL_SHORT, false, STRIDE,
|
||||
add + STRIDE);
|
||||
gl.vertexAttribPointer(aPos0, 4, GL.SHORT, false, STRIDE,
|
||||
add + STRIDE);
|
||||
|
||||
GL.glVertexAttribPointer(aLen0, 2, GL20.GL_SHORT, false, STRIDE,
|
||||
add + STRIDE + LEN_OFFSET);
|
||||
gl.vertexAttribPointer(aLen0, 2, GL.SHORT, false, STRIDE,
|
||||
add + STRIDE + LEN_OFFSET);
|
||||
|
||||
GL.glVertexAttribPointer(aPos1, 4, GL20.GL_SHORT, false, STRIDE,
|
||||
add);
|
||||
gl.vertexAttribPointer(aPos1, 4, GL.SHORT, false, STRIDE,
|
||||
add);
|
||||
|
||||
GL.glVertexAttribPointer(aLen1, 2, GL20.GL_SHORT, false, STRIDE,
|
||||
add + LEN_OFFSET);
|
||||
gl.vertexAttribPointer(aLen1, 2, GL.SHORT, false, STRIDE,
|
||||
add + LEN_OFFSET);
|
||||
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numIndices,
|
||||
GL20.GL_UNSIGNED_SHORT, 0);
|
||||
gl.drawElements(GL.TRIANGLES, numIndices,
|
||||
GL.UNSIGNED_SHORT, 0);
|
||||
}
|
||||
|
||||
/* second pass */
|
||||
@ -402,31 +403,31 @@ public final class LineTexBucket extends RenderBucket {
|
||||
/* i / 6 * (24 shorts per block * 2 short bytes) */
|
||||
int add = (b.vertexOffset + i * 8) + vOffset;
|
||||
|
||||
GL.glVertexAttribPointer(aPos0, 4, GL20.GL_SHORT, false, STRIDE,
|
||||
add + 2 * STRIDE);
|
||||
gl.vertexAttribPointer(aPos0, 4, GL.SHORT, false, STRIDE,
|
||||
add + 2 * STRIDE);
|
||||
|
||||
GL.glVertexAttribPointer(aLen0, 2, GL20.GL_SHORT, false, STRIDE,
|
||||
add + 2 * STRIDE + LEN_OFFSET);
|
||||
gl.vertexAttribPointer(aLen0, 2, GL.SHORT, false, STRIDE,
|
||||
add + 2 * STRIDE + LEN_OFFSET);
|
||||
|
||||
GL.glVertexAttribPointer(aPos1, 4, GL20.GL_SHORT, false, STRIDE,
|
||||
add + STRIDE);
|
||||
gl.vertexAttribPointer(aPos1, 4, GL.SHORT, false, STRIDE,
|
||||
add + STRIDE);
|
||||
|
||||
GL.glVertexAttribPointer(aLen1, 2, GL20.GL_SHORT, false, STRIDE,
|
||||
add + STRIDE + LEN_OFFSET);
|
||||
gl.vertexAttribPointer(aLen1, 2, GL.SHORT, false, STRIDE,
|
||||
add + STRIDE + LEN_OFFSET);
|
||||
|
||||
GL.glDrawElements(GL20.GL_TRIANGLES, numIndices,
|
||||
GL20.GL_UNSIGNED_SHORT, 0);
|
||||
gl.drawElements(GL.TRIANGLES, numIndices,
|
||||
GL.UNSIGNED_SHORT, 0);
|
||||
}
|
||||
//GlUtils.checkGlError(TAG);
|
||||
}
|
||||
|
||||
GL.glDisableVertexAttribArray(aPos0);
|
||||
GL.glDisableVertexAttribArray(aPos1);
|
||||
GL.glDisableVertexAttribArray(aLen0);
|
||||
GL.glDisableVertexAttribArray(aLen1);
|
||||
GL.glDisableVertexAttribArray(aFlip);
|
||||
gl.disableVertexAttribArray(aPos0);
|
||||
gl.disableVertexAttribArray(aPos1);
|
||||
gl.disableVertexAttribArray(aLen0);
|
||||
gl.disableVertexAttribArray(aLen1);
|
||||
gl.disableVertexAttribArray(aFlip);
|
||||
|
||||
//GL.glBindTexture(GL20.GL_TEXTURE_2D, 0);
|
||||
//GL.bindTexture(GL20.TEXTURE_2D, 0);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -16,12 +16,10 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLES;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_SHORT;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.renderer.MapRenderer.COORD_SCALE;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.MercatorProjection;
|
||||
@ -181,7 +179,7 @@ public class MeshBucket extends RenderBucket {
|
||||
v.mvp.setAsUniform(s.uMVP);
|
||||
|
||||
float heightOffset = 0;
|
||||
GL.glUniform1f(s.uHeight, heightOffset);
|
||||
gl.uniform1f(s.uHeight, heightOffset);
|
||||
|
||||
int zoom = v.pos.zoomLevel;
|
||||
float scale = (float) v.pos.getZoomScale();
|
||||
@ -192,7 +190,7 @@ public class MeshBucket extends RenderBucket {
|
||||
if (ml.heightOffset != heightOffset) {
|
||||
heightOffset = ml.heightOffset;
|
||||
|
||||
GL.glUniform1f(s.uHeight, heightOffset /
|
||||
gl.uniform1f(s.uHeight, heightOffset /
|
||||
MercatorProjection.groundResolution(v.pos));
|
||||
}
|
||||
|
||||
@ -201,24 +199,24 @@ public class MeshBucket extends RenderBucket {
|
||||
else {
|
||||
setColor(ml.area.current(), s, zoom, scale);
|
||||
}
|
||||
GL.glVertexAttribPointer(s.aPos, 2, GL_SHORT,
|
||||
false, 0, ml.vertexOffset);
|
||||
gl.vertexAttribPointer(s.aPos, 2, GL.SHORT,
|
||||
false, 0, ml.vertexOffset);
|
||||
|
||||
GL.glDrawElements(GL_TRIANGLES,
|
||||
ml.numIndices,
|
||||
GL_UNSIGNED_SHORT,
|
||||
ml.indiceOffset);
|
||||
gl.drawElements(GL.TRIANGLES,
|
||||
ml.numIndices,
|
||||
GL.UNSIGNED_SHORT,
|
||||
ml.indiceOffset);
|
||||
|
||||
if (dbgRender) {
|
||||
int c = (ml.area == null) ? Color.BLUE : ml.area.color;
|
||||
GL.glLineWidth(1);
|
||||
gl.lineWidth(1);
|
||||
//c = ColorUtil.shiftHue(c, 0.5);
|
||||
c = ColorUtil.modHsv(c, 1.1, 1.0, 0.8, true);
|
||||
GLUtils.setColor(s.uColor, c, 1);
|
||||
GL.glDrawElements(GL20.GL_LINES,
|
||||
ml.numIndices,
|
||||
GL_UNSIGNED_SHORT,
|
||||
ml.vertexOffset);
|
||||
gl.drawElements(GL.LINES,
|
||||
ml.numIndices,
|
||||
GL.UNSIGNED_SHORT,
|
||||
ml.vertexOffset);
|
||||
}
|
||||
}
|
||||
return l;
|
||||
|
@ -16,21 +16,12 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_ALWAYS;
|
||||
import static org.oscim.backend.GL20.GL_EQUAL;
|
||||
import static org.oscim.backend.GL20.GL_INVERT;
|
||||
import static org.oscim.backend.GL20.GL_KEEP;
|
||||
import static org.oscim.backend.GL20.GL_LINES;
|
||||
import static org.oscim.backend.GL20.GL_REPLACE;
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLE_FAN;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLE_STRIP;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_ZERO;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.utils.FastMath.clamp;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.GeometryBuffer;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.renderer.GLMatrix;
|
||||
@ -189,10 +180,10 @@ public final class PolygonBucket extends RenderBucket {
|
||||
float scale, float div) {
|
||||
|
||||
/* draw to framebuffer */
|
||||
GL.glColorMask(true, true, true, true);
|
||||
gl.colorMask(true, true, true, true);
|
||||
|
||||
/* do not modify stencil buffer */
|
||||
GL.glStencilMask(0x00);
|
||||
gl.stencilMask(0x00);
|
||||
Shader s;
|
||||
|
||||
for (int i = start; i < end; i++) {
|
||||
@ -208,7 +199,7 @@ public final class PolygonBucket extends RenderBucket {
|
||||
if (useTexture) {
|
||||
float num = clamp((Tile.SIZE / a.texture.width) >> 1, 1, Tile.SIZE);
|
||||
float transition = Interpolation.exp5.apply(clamp(scale - 1, 0, 1));
|
||||
GL.glUniform2f(s.uScale, transition, div / num);
|
||||
gl.uniform2f(s.uScale, transition, div / num);
|
||||
|
||||
//if (a.texture.alpha);
|
||||
GLState.blend(true);
|
||||
@ -247,15 +238,15 @@ public final class PolygonBucket extends RenderBucket {
|
||||
/* set stencil buffer mask used to draw this layer
|
||||
* also check that clip bit is set to avoid overdraw
|
||||
* of other tiles */
|
||||
GL.glStencilFunc(GL_EQUAL, 0xff, CLIP_BIT | 1 << i);
|
||||
gl.stencilFunc(GL.EQUAL, 0xff, CLIP_BIT | 1 << i);
|
||||
|
||||
/* draw tile fill coordinates */
|
||||
GL.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
if (a.strokeWidth <= 0)
|
||||
continue;
|
||||
|
||||
GL.glStencilFunc(GL_EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
|
||||
GLState.blend(true);
|
||||
|
||||
@ -264,19 +255,19 @@ public final class PolygonBucket extends RenderBucket {
|
||||
GLUtils.setColor(HairLineBucket.Renderer.shader.uColor,
|
||||
l.area.strokeColor, 1);
|
||||
|
||||
GL.glVertexAttribPointer(HairLineBucket.Renderer.shader.aPos,
|
||||
2, GL_SHORT, false, 0,
|
||||
// 4 bytes per vertex
|
||||
l.vertexOffset << 2);
|
||||
gl.vertexAttribPointer(HairLineBucket.Renderer.shader.aPos,
|
||||
2, GL.SHORT, false, 0,
|
||||
// 4 bytes per vertex
|
||||
l.vertexOffset << 2);
|
||||
|
||||
GL.glUniform1f(HairLineBucket.Renderer.shader.uWidth,
|
||||
a.strokeWidth);
|
||||
gl.uniform1f(HairLineBucket.Renderer.shader.uWidth,
|
||||
a.strokeWidth);
|
||||
|
||||
GL.glDrawElements(GL_LINES,
|
||||
l.numIndices,
|
||||
GL_UNSIGNED_SHORT,
|
||||
l.indiceOffset);
|
||||
GL.glLineWidth(1);
|
||||
gl.drawElements(GL.LINES,
|
||||
l.numIndices,
|
||||
GL.UNSIGNED_SHORT,
|
||||
l.indiceOffset);
|
||||
gl.lineWidth(1);
|
||||
|
||||
///* disable texture shader */
|
||||
//if (s != polyShader)
|
||||
@ -293,8 +284,8 @@ public final class PolygonBucket extends RenderBucket {
|
||||
if (shader.useProgram() || first) {
|
||||
GLState.enableVertexArrays(shader.aPos, -1);
|
||||
|
||||
GL.glVertexAttribPointer(shader.aPos, 2,
|
||||
GL_SHORT, false, 0, 0);
|
||||
gl.vertexAttribPointer(shader.aPos, 2,
|
||||
GL.SHORT, false, 0, 0);
|
||||
|
||||
mvp.setAsUniform(shader.uMVP);
|
||||
}
|
||||
@ -340,10 +331,10 @@ public final class PolygonBucket extends RenderBucket {
|
||||
int start = mCount;
|
||||
|
||||
/* draw to stencil buffer */
|
||||
GL.glColorMask(false, false, false, false);
|
||||
gl.colorMask(false, false, false, false);
|
||||
|
||||
/* op for stencil method polygon drawing */
|
||||
GL.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT);
|
||||
gl.stencilOp(GL.KEEP, GL.KEEP, GL.INVERT);
|
||||
|
||||
boolean drawn = false;
|
||||
|
||||
@ -395,7 +386,7 @@ public final class PolygonBucket extends RenderBucket {
|
||||
if (mClear) {
|
||||
clearStencilRegion();
|
||||
/* op for stencil method polygon drawing */
|
||||
GL.glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT);
|
||||
gl.stencilOp(GL.KEEP, GL.KEEP, GL.INVERT);
|
||||
|
||||
start = cur = 0;
|
||||
}
|
||||
@ -406,15 +397,15 @@ public final class PolygonBucket extends RenderBucket {
|
||||
int stencil = 1 << cur++;
|
||||
|
||||
if (area.hasAlpha(zoom)) {
|
||||
GL.glStencilMask(stencil);
|
||||
gl.stencilMask(stencil);
|
||||
stencilMask |= stencil;
|
||||
}
|
||||
else {
|
||||
stencilMask |= stencil;
|
||||
GL.glStencilMask(stencilMask);
|
||||
gl.stencilMask(stencilMask);
|
||||
}
|
||||
|
||||
GL.glDrawArrays(GL_TRIANGLE_FAN, b.vertexOffset, b.numVertices);
|
||||
gl.drawArrays(GL.TRIANGLE_FAN, b.vertexOffset, b.numVertices);
|
||||
|
||||
/* draw up to 7 buckets into stencil buffer */
|
||||
if (cur == STENCIL_BITS - 1) {
|
||||
@ -442,8 +433,8 @@ public final class PolygonBucket extends RenderBucket {
|
||||
/* fillPolygons would re-enable color-mask
|
||||
* but it's possible that all polygon buckets
|
||||
* were skipped */
|
||||
GL.glColorMask(true, true, true, true);
|
||||
GL.glStencilMask(0x00);
|
||||
gl.colorMask(true, true, true, true);
|
||||
gl.stencilMask(0x00);
|
||||
}
|
||||
|
||||
mCount = cur;
|
||||
@ -456,10 +447,10 @@ public final class PolygonBucket extends RenderBucket {
|
||||
drawStencilRegion(clipMode);
|
||||
|
||||
/* disable writes to stencil buffer */
|
||||
GL.glStencilMask(0x00);
|
||||
gl.stencilMask(0x00);
|
||||
|
||||
/* enable writes to color buffer */
|
||||
GL.glColorMask(true, true, true, true);
|
||||
gl.colorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -475,41 +466,41 @@ public final class PolygonBucket extends RenderBucket {
|
||||
mClear = false;
|
||||
|
||||
/* disable drawing to color buffer */
|
||||
GL.glColorMask(false, false, false, false);
|
||||
gl.colorMask(false, false, false, false);
|
||||
|
||||
/* write to all stencil bits */
|
||||
GL.glStencilMask(0xFF);
|
||||
gl.stencilMask(0xFF);
|
||||
|
||||
/* Draw clip-region into depth and stencil buffer.
|
||||
* This is used for tile line and polygon buckets.
|
||||
*
|
||||
* Together with depth test (GL_LESS) this ensures to
|
||||
* Together with depth test (GL20.LESS) this ensures to
|
||||
* only draw where no other tile has drawn yet. */
|
||||
|
||||
if (clipMode == CLIP_DEPTH) {
|
||||
/* tests GL_LESS/GL_ALWAYS and */
|
||||
/* tests GL20.LESS/GL20.ALWAYS and */
|
||||
/* write tile region to depth buffer */
|
||||
GLState.test(true, true);
|
||||
GL.glDepthMask(true);
|
||||
gl.depthMask(true);
|
||||
} else {
|
||||
GLState.test(false, true);
|
||||
}
|
||||
|
||||
/* always pass stencil test and set clip bit */
|
||||
GL.glStencilFunc(GL_ALWAYS, CLIP_BIT, 0x00);
|
||||
gl.stencilFunc(GL.ALWAYS, CLIP_BIT, 0x00);
|
||||
|
||||
/* set clip bit (0x80) for draw region */
|
||||
GL.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
gl.stencilOp(GL.KEEP, GL.KEEP, GL.REPLACE);
|
||||
|
||||
/* draw a quad for the tile region */
|
||||
GL.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
if (clipMode == CLIP_DEPTH) {
|
||||
/* dont modify depth buffer */
|
||||
GL.glDepthMask(false);
|
||||
gl.depthMask(false);
|
||||
GLState.test(false, true);
|
||||
}
|
||||
GL.glStencilFunc(GL_EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
}
|
||||
|
||||
static void clearStencilRegion() {
|
||||
@ -518,20 +509,20 @@ public final class PolygonBucket extends RenderBucket {
|
||||
mClear = false;
|
||||
|
||||
/* disable drawing to color buffer */
|
||||
GL.glColorMask(false, false, false, false);
|
||||
gl.colorMask(false, false, false, false);
|
||||
|
||||
/* write to all stencil bits except clip bit */
|
||||
GL.glStencilMask(0xFF);
|
||||
gl.stencilMask(0xFF);
|
||||
|
||||
/* use clip bit from stencil buffer to clear stencil
|
||||
* 'layer-bits' (0x7f) */
|
||||
GL.glStencilFunc(GL_EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
|
||||
/* set clip bit (0x80) for draw region */
|
||||
GL.glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
gl.stencilOp(GL.KEEP, GL.KEEP, GL.REPLACE);
|
||||
|
||||
/* draw a quad for the tile region */
|
||||
GL.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -544,30 +535,30 @@ public final class PolygonBucket extends RenderBucket {
|
||||
setShader(polyShader, mvp, true);
|
||||
|
||||
if (color == 0) {
|
||||
GL.glColorMask(false, false, false, false);
|
||||
gl.colorMask(false, false, false, false);
|
||||
} else {
|
||||
GLUtils.setColor(polyShader.uColor, color, alpha);
|
||||
GLState.blend(true);
|
||||
}
|
||||
|
||||
// TODO always pass stencil test: <-- only if not proxy?
|
||||
//GL.glStencilFunc(GL_ALWAYS, 0x00, 0x00);
|
||||
//GL.stencilFunc(GL20.ALWAYS, 0x00, 0x00);
|
||||
|
||||
GL.glStencilFunc(GL_EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
gl.stencilFunc(GL.EQUAL, CLIP_BIT, CLIP_BIT);
|
||||
|
||||
/* write to all bits */
|
||||
GL.glStencilMask(0xFF);
|
||||
gl.stencilMask(0xFF);
|
||||
|
||||
// FIXME uneeded probably
|
||||
GLState.test(false, true);
|
||||
|
||||
/* zero out area to draw to */
|
||||
GL.glStencilOp(GL_KEEP, GL_KEEP, GL_ZERO);
|
||||
gl.stencilOp(GL.KEEP, GL.KEEP, GL.ZERO);
|
||||
|
||||
GL.glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
gl.drawArrays(GL.TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
if (color == 0)
|
||||
GL.glColorMask(true, true, true, true);
|
||||
gl.colorMask(true, true, true, true);
|
||||
}
|
||||
|
||||
private Renderer() {
|
||||
|
@ -18,11 +18,9 @@ package org.oscim.renderer.bucket;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.utils.pool.Inlist;
|
||||
|
||||
public abstract class RenderBucket extends Inlist<RenderBucket> {
|
||||
protected static GL20 GL;
|
||||
|
||||
public static final int LINE = 0;
|
||||
public static final int TEXLINE = 1;
|
||||
|
@ -24,7 +24,7 @@ import static org.oscim.renderer.bucket.RenderBucket.TEXLINE;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.core.Tile;
|
||||
import org.oscim.layers.tile.MapTile.TileData;
|
||||
import org.oscim.renderer.BufferObject;
|
||||
@ -392,13 +392,13 @@ public class RenderBuckets extends TileData {
|
||||
}
|
||||
|
||||
if (vbo == null)
|
||||
vbo = BufferObject.get(GL20.GL_ARRAY_BUFFER, vboSize);
|
||||
vbo = BufferObject.get(GL.ARRAY_BUFFER, vboSize);
|
||||
|
||||
vbo.loadBufferData(vboData.flip(), vboSize * 2);
|
||||
|
||||
if (iboSize > 0) {
|
||||
if (ibo == null)
|
||||
ibo = BufferObject.get(GL20.GL_ELEMENT_ARRAY_BUFFER, iboSize);
|
||||
ibo = BufferObject.get(GL.ELEMENT_ARRAY_BUFFER, iboSize);
|
||||
|
||||
ibo.loadBufferData(iboData.flip(), iboSize * 2);
|
||||
}
|
||||
@ -413,9 +413,7 @@ public class RenderBuckets extends TileData {
|
||||
fillCoords = new short[] { 0, s, s, s, 0, 0, s, 0 };
|
||||
}
|
||||
|
||||
public static void initRenderer(GL20 gl) {
|
||||
RenderBucket.GL = gl;
|
||||
|
||||
public static void initRenderer() {
|
||||
LineBucket.Renderer.init();
|
||||
LineTexBucket.Renderer.init();
|
||||
PolygonBucket.Renderer.init();
|
||||
@ -423,7 +421,5 @@ public class RenderBuckets extends TileData {
|
||||
BitmapBucket.Renderer.init();
|
||||
MeshBucket.Renderer.init();
|
||||
HairLineBucket.Renderer.init();
|
||||
|
||||
TextureItem.init(gl);
|
||||
}
|
||||
}
|
||||
|
@ -16,14 +16,13 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GL20.GL_SHORT;
|
||||
import static org.oscim.backend.GL20.GL_TRIANGLES;
|
||||
import static org.oscim.backend.GL20.GL_UNSIGNED_SHORT;
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
import static org.oscim.renderer.MapRenderer.COORD_SCALE;
|
||||
import static org.oscim.renderer.MapRenderer.MAX_INDICES;
|
||||
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.renderer.GLShader;
|
||||
import org.oscim.renderer.GLState;
|
||||
import org.oscim.renderer.GLViewport;
|
||||
@ -119,7 +118,7 @@ public class TextureBucket extends RenderBucket {
|
||||
shader.useProgram();
|
||||
|
||||
TextureBucket tb = (TextureBucket) b;
|
||||
GL.glUniform1f(shader.uScale, tb.fixed ? 1 / scale : 1);
|
||||
gl.uniform1f(shader.uScale, tb.fixed ? 1 / scale : 1);
|
||||
|
||||
v.proj.setAsUniform(shader.uProj);
|
||||
v.mvp.setAsUniform(shader.uMV);
|
||||
@ -127,9 +126,9 @@ public class TextureBucket extends RenderBucket {
|
||||
MapRenderer.bindQuadIndicesVBO();
|
||||
|
||||
for (TextureItem t = tb.textures; t != null; t = t.next) {
|
||||
GL.glUniform2f(shader.uTexSize,
|
||||
1f / (t.width * COORD_SCALE),
|
||||
1f / (t.height * COORD_SCALE));
|
||||
gl.uniform2f(shader.uTexSize,
|
||||
1f / (t.width * COORD_SCALE),
|
||||
1f / (t.height * COORD_SCALE));
|
||||
t.bind();
|
||||
|
||||
/* draw up to maxVertices in each iteration */
|
||||
@ -155,13 +154,13 @@ public class TextureBucket extends RenderBucket {
|
||||
}
|
||||
|
||||
public void render(int offset, int numIndices) {
|
||||
GL.glVertexAttribPointer(shader.aPos, 4, GL_SHORT,
|
||||
false, 12, offset);
|
||||
gl.vertexAttribPointer(shader.aPos, 4, GL.SHORT,
|
||||
false, 12, offset);
|
||||
|
||||
GL.glVertexAttribPointer(shader.aTexCoord, 2, GL_SHORT,
|
||||
false, 12, offset + 8);
|
||||
gl.vertexAttribPointer(shader.aTexCoord, 2, GL.SHORT,
|
||||
false, 12, offset + 8);
|
||||
|
||||
GL.glDrawElements(GL_TRIANGLES, numIndices,
|
||||
GL_UNSIGNED_SHORT, 0);
|
||||
gl.drawElements(GL.TRIANGLES, numIndices,
|
||||
GL.UNSIGNED_SHORT, 0);
|
||||
}
|
||||
}
|
||||
|
@ -16,12 +16,14 @@
|
||||
*/
|
||||
package org.oscim.renderer.bucket;
|
||||
|
||||
import static org.oscim.backend.GLAdapter.gl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import javax.annotation.CheckReturnValue;
|
||||
|
||||
import org.oscim.backend.CanvasAdapter;
|
||||
import org.oscim.backend.GL20;
|
||||
import org.oscim.backend.GL;
|
||||
import org.oscim.backend.canvas.Bitmap;
|
||||
import org.oscim.backend.canvas.Color;
|
||||
import org.oscim.renderer.GLState;
|
||||
@ -287,21 +289,21 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
protected void initTexture(TextureItem t) {
|
||||
GLState.bindTex2D(t.id);
|
||||
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MIN_FILTER,
|
||||
GL20.GL_LINEAR);
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_MAG_FILTER,
|
||||
GL20.GL_LINEAR);
|
||||
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_MIN_FILTER,
|
||||
GL.LINEAR);
|
||||
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_MAG_FILTER,
|
||||
GL.LINEAR);
|
||||
|
||||
if (t.repeat) {
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_S,
|
||||
GL20.GL_REPEAT);
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_T,
|
||||
GL20.GL_REPEAT);
|
||||
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S,
|
||||
GL.REPEAT);
|
||||
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T,
|
||||
GL.REPEAT);
|
||||
} else {
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_S,
|
||||
GL20.GL_CLAMP_TO_EDGE);
|
||||
GL.glTexParameterf(GL20.GL_TEXTURE_2D, GL20.GL_TEXTURE_WRAP_T,
|
||||
GL20.GL_CLAMP_TO_EDGE);
|
||||
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_S,
|
||||
GL.CLAMP_TO_EDGE);
|
||||
gl.texParameterf(GL.TEXTURE_2D, GL.TEXTURE_WRAP_T,
|
||||
GL.CLAMP_TO_EDGE);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -311,12 +313,6 @@ public class TextureItem extends Inlist<TextureItem> {
|
||||
final static TexturePool NOPOOL = new TexturePool(0);
|
||||
final static ArrayList<Integer> disposedTextures = new ArrayList<Integer>();
|
||||
|
||||
private static GL20 GL;
|
||||
|
||||
static void init(GL20 gl) {
|
||||
GL = gl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disposed textures are released by MapRenderer after each frame
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user