diff options
Diffstat (limited to 'opengl')
26 files changed, 1330 insertions, 628 deletions
diff --git a/opengl/java/android/opengl/GLES11.java b/opengl/java/android/opengl/GLES11.java index 3399af7..1ca179b 100644 --- a/opengl/java/android/opengl/GLES11.java +++ b/opengl/java/android/opengl/GLES11.java @@ -150,6 +150,7 @@ public class GLES11 extends GLES10 { _nativeClassInit(); } + private static Buffer _pointSizePointerOES; // C function void glBindBuffer ( GLenum target, GLuint buffer ) public static native void glBindBuffer( @@ -596,12 +597,31 @@ public class GLES11 extends GLES10 { // C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) - public static native void glPointSizePointerOES( + private static native void glPointSizePointerOESBounds( int type, int stride, - java.nio.Buffer pointer + java.nio.Buffer pointer, + int remaining ); + public static void glPointSizePointerOES( + int type, + int stride, + java.nio.Buffer pointer + ) { + glPointSizePointerOESBounds( + type, + stride, + pointer, + pointer.remaining() + ); + if (((type == GL_FLOAT) || + (type == GL_FIXED)) && + (stride >= 0)) { + _pointSizePointerOES = pointer; + } + } + // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) public static native void glTexCoordPointer( diff --git a/opengl/java/android/opengl/GLES11Ext.java b/opengl/java/android/opengl/GLES11Ext.java index 4384e9e..25d5467 100644 --- a/opengl/java/android/opengl/GLES11Ext.java +++ b/opengl/java/android/opengl/GLES11Ext.java @@ -19,6 +19,8 @@ package android.opengl; +import java.nio.Buffer; + public class GLES11Ext { public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009; public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D; @@ -129,6 +131,12 @@ public class GLES11Ext { _nativeClassInit(); } + private static final int GL_BYTE = GLES10.GL_BYTE; + private static final int GL_FIXED = GLES10.GL_FIXED; + private static final int GL_FLOAT = GLES10.GL_FLOAT; + private static final int GL_SHORT = GLES10.GL_SHORT; + + private static Buffer _matrixIndexPointerOES; // C function void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) public static native void glBlendEquationSeparateOES( @@ -866,22 +874,64 @@ public class GLES11Ext { // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) - public static native void glMatrixIndexPointerOES( + private static native void glMatrixIndexPointerOESBounds( int size, int type, int stride, - java.nio.Buffer pointer + java.nio.Buffer pointer, + int remaining ); + public static void glMatrixIndexPointerOES( + int size, + int type, + int stride, + java.nio.Buffer pointer + ) { + glMatrixIndexPointerOESBounds( + size, + type, + stride, + pointer, + pointer.remaining() + ); + if (((size == 2) || + (size == 3) || + (size == 4)) && + ((type == GL_FLOAT) || + (type == GL_BYTE) || + (type == GL_SHORT) || + (type == GL_FIXED)) && + (stride >= 0)) { + _matrixIndexPointerOES = pointer; + } + } + // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) - public static native void glWeightPointerOES( + private static native void glWeightPointerOESBounds( int size, int type, int stride, - java.nio.Buffer pointer + java.nio.Buffer pointer, + int remaining ); + public static void glWeightPointerOES( + int size, + int type, + int stride, + java.nio.Buffer pointer + ) { + glWeightPointerOESBounds( + size, + type, + stride, + pointer, + pointer.remaining() + ); + } + // C function void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) public static native void glDepthRangefOES( diff --git a/opengl/java/android/opengl/GLES20.java b/opengl/java/android/opengl/GLES20.java index 7ce318f..b8aac0e 100644 --- a/opengl/java/android/opengl/GLES20.java +++ b/opengl/java/android/opengl/GLES20.java @@ -20,7 +20,6 @@ package android.opengl; /** OpenGL ES 2.0 - * @hide */ public class GLES20 { public static final int GL_ACTIVE_TEXTURE = 0x84E0; diff --git a/opengl/java/android/opengl/GLErrorWrapper.java b/opengl/java/android/opengl/GLErrorWrapper.java index 884a1a0..9b66e49 100644 --- a/opengl/java/android/opengl/GLErrorWrapper.java +++ b/opengl/java/android/opengl/GLErrorWrapper.java @@ -958,4 +958,424 @@ class GLErrorWrapper extends GLWrapperBase { checkError(); return valid; } + + public void glBindBuffer(int target, int buffer) { + checkThread(); + mgl11.glBindBuffer(target, buffer); + checkError(); + } + + public void glBufferData(int target, int size, Buffer data, int usage) { + checkThread(); + mgl11.glBufferData(target, size, data, usage); + checkError(); + } + + public void glBufferSubData(int target, int offset, int size, Buffer data) { + checkThread(); + mgl11.glBufferSubData(target, offset, size, data); + checkError(); + } + + public void glColor4ub(byte red, byte green, byte blue, byte alpha) { + checkThread(); + mgl11.glColor4ub(red, green, blue, alpha); + checkError(); } + + public void glColorPointer(int size, int type, int stride, int offset) { + checkThread(); + mgl11.glColorPointer(size, type, stride, offset); + checkError(); + } + + public void glDeleteBuffers(int n, int[] buffers, int offset) { + checkThread(); + mgl11.glDeleteBuffers(n, buffers, offset); + checkError(); + } + + public void glDeleteBuffers(int n, IntBuffer buffers) { + checkThread(); + mgl11.glDeleteBuffers(n, buffers); + checkError(); + } + + public void glDrawElements(int mode, int count, int type, int offset) { + checkThread(); + mgl11.glDrawElements(mode, count, type, offset); + checkError(); + } + + public void glGenBuffers(int n, int[] buffers, int offset) { + checkThread(); + mgl11.glGenBuffers(n, buffers, offset); + checkError(); + } + + public void glGenBuffers(int n, IntBuffer buffers) { + checkThread(); + mgl11.glGenBuffers(n, buffers); + checkError(); + } + + public void glGetBooleanv(int pname, boolean[] params, int offset) { + checkThread(); + mgl11.glGetBooleanv(pname, params, offset); + checkError(); + } + + public void glGetBooleanv(int pname, IntBuffer params) { + checkThread(); + mgl11.glGetBooleanv(pname, params); + checkError(); + } + + public void glGetBufferParameteriv(int target, int pname, int[] params, + int offset) { + checkThread(); + mgl11.glGetBufferParameteriv(target, pname, params, offset); + checkError(); + } + + public void glGetBufferParameteriv(int target, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetBufferParameteriv(target, pname, params); + checkError(); + } + + public void glGetClipPlanef(int pname, float[] eqn, int offset) { + checkThread(); + mgl11.glGetClipPlanef(pname, eqn, offset); + checkError(); + } + + public void glGetClipPlanef(int pname, FloatBuffer eqn) { + checkThread(); + mgl11.glGetClipPlanef(pname, eqn); + checkError(); + } + + public void glGetClipPlanex(int pname, int[] eqn, int offset) { + checkThread(); + mgl11.glGetClipPlanex(pname, eqn, offset); + checkError(); + } + + public void glGetClipPlanex(int pname, IntBuffer eqn) { + checkThread(); + mgl11.glGetClipPlanex(pname, eqn); + checkError(); + } + + public void glGetFixedv(int pname, int[] params, int offset) { + checkThread(); + mgl11.glGetFixedv(pname, params, offset); + checkError(); + } + + public void glGetFixedv(int pname, IntBuffer params) { + checkThread(); + mgl11.glGetFixedv(pname, params); + checkError(); + } + + public void glGetFloatv(int pname, float[] params, int offset) { + checkThread(); + mgl11.glGetFloatv(pname, params, offset); + checkError(); + } + + public void glGetFloatv(int pname, FloatBuffer params) { + checkThread(); + mgl11.glGetFloatv(pname, params); + checkError(); + } + + public void glGetLightfv(int light, int pname, float[] params, int offset) { + checkThread(); + mgl11.glGetLightfv(light, pname, params, offset); + checkError(); + } + + public void glGetLightfv(int light, int pname, FloatBuffer params) { + checkThread(); + mgl11.glGetLightfv(light, pname, params); + checkError(); + } + + public void glGetLightxv(int light, int pname, int[] params, int offset) { + checkThread(); + mgl11.glGetLightxv(light, pname, params, offset); + checkError(); + } + + public void glGetLightxv(int light, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetLightxv(light, pname, params); + checkError(); + } + + public void glGetMaterialfv(int face, int pname, float[] params, int offset) { + checkThread(); + mgl11.glGetMaterialfv(face, pname, params, offset); + checkError(); + } + + public void glGetMaterialfv(int face, int pname, FloatBuffer params) { + checkThread(); + mgl11.glGetMaterialfv(face, pname, params); + checkError(); + } + + public void glGetMaterialxv(int face, int pname, int[] params, int offset) { + checkThread(); + mgl11.glGetMaterialxv(face, pname, params, offset); + checkError(); + } + + public void glGetMaterialxv(int face, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetMaterialxv(face, pname, params); + checkError(); + } + + public void glGetPointerv(int pname, Buffer[] params) { + checkThread(); + mgl11.glGetPointerv(pname, params); + checkError(); + } + + public void glGetTexEnviv(int env, int pname, int[] params, int offset) { + checkThread(); + mgl11.glGetTexEnviv(env, pname, params, offset); + checkError(); + } + + public void glGetTexEnviv(int env, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetTexEnviv(env, pname, params); + checkError(); + } + + public void glGetTexEnvxv(int env, int pname, int[] params, int offset) { + checkThread(); + mgl11.glGetTexEnvxv(env, pname, params, offset); + checkError(); + } + + public void glGetTexEnvxv(int env, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetTexEnvxv(env, pname, params); + checkError(); + } + + public void glGetTexParameterfv(int target, int pname, float[] params, + int offset) { + checkThread(); + mgl11.glGetTexParameterfv(target, pname, params, offset); + checkError(); + } + + public void glGetTexParameterfv(int target, int pname, FloatBuffer params) { + checkThread(); + mgl11.glGetTexParameterfv(target, pname, params); + checkError(); + } + + public void glGetTexParameteriv(int target, int pname, int[] params, + int offset) { + checkThread(); + mgl11.glGetTexParameteriv(target, pname, params, offset); + checkError(); + } + + public void glGetTexParameteriv(int target, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetTexParameteriv(target, pname, params); + checkError(); + } + + public void glGetTexParameterxv(int target, int pname, int[] params, + int offset) { + checkThread(); + mgl11.glGetTexParameterxv(target, pname, params, offset); + checkError(); + } + + public void glGetTexParameterxv(int target, int pname, IntBuffer params) { + checkThread(); + mgl11.glGetTexParameterxv(target, pname, params); + checkError(); + } + + public boolean glIsBuffer(int buffer) { + checkThread(); + boolean valid = mgl11.glIsBuffer(buffer); + checkError(); + return valid; + } + + public boolean glIsEnabled(int cap) { + checkThread(); + boolean valid = mgl11.glIsEnabled(cap); + checkError(); + return valid; + } + + public boolean glIsTexture(int texture) { + checkThread(); + boolean valid = mgl11.glIsTexture(texture); + checkError(); + return valid; + } + + public void glNormalPointer(int type, int stride, int offset) { + checkThread(); + mgl11.glNormalPointer(type, stride, offset); + checkError(); + } + + public void glPointParameterf(int pname, float param) { + checkThread(); + mgl11.glPointParameterf(pname, param); + checkError(); + } + + public void glPointParameterfv(int pname, float[] params, int offset) { + checkThread(); + mgl11.glPointParameterfv(pname, params, offset); + checkError(); + } + + public void glPointParameterfv(int pname, FloatBuffer params) { + checkThread(); + mgl11.glPointParameterfv(pname, params); + checkError(); + } + + public void glPointParameterx(int pname, int param) { + checkThread(); + mgl11.glPointParameterx(pname, param); + checkError(); + } + + public void glPointParameterxv(int pname, int[] params, int offset) { + checkThread(); + mgl11.glPointParameterxv(pname, params, offset); + checkError(); + } + + public void glPointParameterxv(int pname, IntBuffer params) { + checkThread(); + mgl11.glPointParameterxv(pname, params); + checkError(); + } + + public void glPointSizePointerOES(int type, int stride, Buffer pointer) { + checkThread(); + mgl11.glPointSizePointerOES(type, stride, pointer); + checkError(); + } + + public void glTexCoordPointer(int size, int type, int stride, int offset) { + checkThread(); + mgl11.glTexCoordPointer(size, type, stride, offset); + checkError(); + } + + public void glTexEnvi(int target, int pname, int param) { + checkThread(); + mgl11.glTexEnvi(target, pname, param); + checkError(); + } + + public void glTexEnviv(int target, int pname, int[] params, int offset) { + checkThread(); + mgl11.glTexEnviv(target, pname, params, offset); + checkError(); + } + + public void glTexEnviv(int target, int pname, IntBuffer params) { + checkThread(); + mgl11.glTexEnviv(target, pname, params); + checkError(); + } + + public void glTexParameterfv(int target, int pname, float[] params, + int offset) { + checkThread(); + mgl11.glTexParameterfv(target, pname, params, offset); + checkError(); + } + + public void glTexParameterfv(int target, int pname, FloatBuffer params) { + checkThread(); + mgl11.glTexParameterfv(target, pname, params); + checkError(); + } + + public void glTexParameteri(int target, int pname, int param) { + checkThread(); + mgl11.glTexParameteri(target, pname, param); + checkError(); + } + + public void glTexParameterxv(int target, int pname, int[] params, int offset) { + checkThread(); + mgl11.glTexParameterxv(target, pname, params, offset); + checkError(); + } + + public void glTexParameterxv(int target, int pname, IntBuffer params) { + checkThread(); + mgl11.glTexParameterxv(target, pname, params); + checkError(); + } + + public void glVertexPointer(int size, int type, int stride, int offset) { + checkThread(); + mgl11.glVertexPointer(size, type, stride, offset); + checkError(); + } + + public void glCurrentPaletteMatrixOES(int matrixpaletteindex) { + checkThread(); + mgl11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex); + checkError(); + } + + public void glLoadPaletteFromModelViewMatrixOES() { + checkThread(); + mgl11Ext.glLoadPaletteFromModelViewMatrixOES(); + checkError(); + } + + public void glMatrixIndexPointerOES(int size, int type, int stride, + Buffer pointer) { + checkThread(); + mgl11Ext.glMatrixIndexPointerOES(size, type, stride, pointer); + checkError(); + } + + public void glMatrixIndexPointerOES(int size, int type, int stride, + int offset) { + checkThread(); + mgl11Ext.glMatrixIndexPointerOES(size, type, stride, offset); + checkError(); + } + + public void glWeightPointerOES(int size, int type, int stride, + Buffer pointer) { + checkThread(); + mgl11Ext.glWeightPointerOES(size, type, stride, pointer); + checkError(); + } + + public void glWeightPointerOES(int size, int type, int stride, int offset) { + checkThread(); + mgl11Ext.glWeightPointerOES(size, type, stride, offset); + checkError(); + } + + } diff --git a/opengl/java/android/opengl/GLLogWrapper.java b/opengl/java/android/opengl/GLLogWrapper.java index f332448..6e97f67 100644 --- a/opengl/java/android/opengl/GLLogWrapper.java +++ b/opengl/java/android/opengl/GLLogWrapper.java @@ -932,83 +932,83 @@ class GLLogWrapper extends GLWrapperBase { boolean convertWholeBuffer = (byteCount < 0); if (input instanceof ByteBuffer) { ByteBuffer input2 = (ByteBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit(); + byteCount = input2.limit() - position; } result = ByteBuffer.allocate(byteCount).order(input2.order()); - int position = input2.position(); for (int i = 0; i < byteCount; i++) { result.put(input2.get()); } input2.position(position); } else if (input instanceof CharBuffer) { CharBuffer input2 = (CharBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit() * 2; + byteCount = (input2.limit() - position) * 2; } result = ByteBuffer.allocate(byteCount).order(input2.order()); CharBuffer result2 = result.asCharBuffer(); - int position = input2.position(); for (int i = 0; i < byteCount / 2; i++) { result2.put(input2.get()); } input2.position(position); } else if (input instanceof ShortBuffer) { ShortBuffer input2 = (ShortBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit() * 2; + byteCount = (input2.limit() - position)* 2; } result = ByteBuffer.allocate(byteCount).order(input2.order()); ShortBuffer result2 = result.asShortBuffer(); - int position = input2.position(); for (int i = 0; i < byteCount / 2; i++) { result2.put(input2.get()); } input2.position(position); } else if (input instanceof IntBuffer) { IntBuffer input2 = (IntBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit() * 4; + byteCount = (input2.limit() - position) * 4; } result = ByteBuffer.allocate(byteCount).order(input2.order()); IntBuffer result2 = result.asIntBuffer(); - int position = input2.position(); for (int i = 0; i < byteCount / 4; i++) { result2.put(input2.get()); } input2.position(position); } else if (input instanceof FloatBuffer) { FloatBuffer input2 = (FloatBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit() * 4; + byteCount = (input2.limit() - position) * 4; } result = ByteBuffer.allocate(byteCount).order(input2.order()); FloatBuffer result2 = result.asFloatBuffer(); - int position = input2.position(); for (int i = 0; i < byteCount / 4; i++) { result2.put(input2.get()); } input2.position(position); } else if (input instanceof DoubleBuffer) { DoubleBuffer input2 = (DoubleBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit() * 8; + byteCount = (input2.limit() - position) * 8; } result = ByteBuffer.allocate(byteCount).order(input2.order()); DoubleBuffer result2 = result.asDoubleBuffer(); - int position = input2.position(); for (int i = 0; i < byteCount / 8; i++) { result2.put(input2.get()); } input2.position(position); } else if (input instanceof LongBuffer) { LongBuffer input2 = (LongBuffer) input; + int position = input2.position(); if (convertWholeBuffer) { - byteCount = input2.limit() * 8; + byteCount = (input2.limit() - position) * 8; } result = ByteBuffer.allocate(byteCount).order(input2.order()); LongBuffer result2 = result.asLongBuffer(); - int position = input2.position(); for (int i = 0; i < byteCount / 8; i++) { result2.put(input2.get()); } @@ -1064,8 +1064,8 @@ class GLLogWrapper extends GLWrapperBase { } builder.append(" "); builder.append(name + ":{"); - if (pointer == null) { - builder.append("undefined"); + if (pointer == null || pointer.mTempByteBuffer == null ) { + builder.append("undefined }"); return; } if (pointer.mStride < 0) { @@ -2767,230 +2767,684 @@ class GLLogWrapper extends GLWrapperBase { return valid; } - // Unsupported GL11 methods - public void glBindBuffer(int target, int buffer) { - throw new UnsupportedOperationException(); + begin("glBindBuffer"); + arg("target", target); + arg("buffer", buffer); + end(); + mgl11.glBindBuffer(target, buffer); + checkError(); } public void glBufferData(int target, int size, Buffer data, int usage) { - throw new UnsupportedOperationException(); + begin("glBufferData"); + arg("target", target); + arg("size", size); + arg("data", data.toString()); + arg("usage", usage); + end(); + mgl11.glBufferData(target, size, data, usage); + checkError(); } public void glBufferSubData(int target, int offset, int size, Buffer data) { - throw new UnsupportedOperationException(); + begin("glBufferSubData"); + arg("target", target); + arg("offset", offset); + arg("size", size); + arg("data", data.toString()); + end(); + mgl11.glBufferSubData(target, offset, size, data); + checkError(); } public void glColor4ub(byte red, byte green, byte blue, byte alpha) { - throw new UnsupportedOperationException(); + begin("glColor4ub"); + arg("red", red); + arg("green", green); + arg("blue", blue); + arg("alpha", alpha); + end(); + mgl11.glColor4ub(red, green, blue, alpha); + checkError(); } public void glDeleteBuffers(int n, int[] buffers, int offset) { - throw new UnsupportedOperationException(); + begin("glDeleteBuffers"); + arg("n", n); + arg("buffers", buffers.toString()); + arg("offset", offset); + end(); + mgl11.glDeleteBuffers(n, buffers, offset); + checkError(); } public void glDeleteBuffers(int n, IntBuffer buffers) { - throw new UnsupportedOperationException(); + begin("glDeleteBuffers"); + arg("n", n); + arg("buffers", buffers.toString()); + end(); + mgl11.glDeleteBuffers(n, buffers); + checkError(); } public void glGenBuffers(int n, int[] buffers, int offset) { - throw new UnsupportedOperationException(); + begin("glGenBuffers"); + arg("n", n); + arg("buffers", buffers.toString()); + arg("offset", offset); + end(); + mgl11.glGenBuffers(n, buffers, offset); + checkError(); } public void glGenBuffers(int n, IntBuffer buffers) { - throw new UnsupportedOperationException(); + begin("glGenBuffers"); + arg("n", n); + arg("buffers", buffers.toString()); + end(); + mgl11.glGenBuffers(n, buffers); + checkError(); } public void glGetBooleanv(int pname, boolean[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetBooleanv"); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetBooleanv(pname, params, offset); + checkError(); } public void glGetBooleanv(int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetBooleanv"); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetBooleanv(pname, params); + checkError(); } - public void glGetBufferParameteriv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + public void glGetBufferParameteriv(int target, int pname, int[] params, + int offset) { + begin("glGetBufferParameteriv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetBufferParameteriv(target, pname, params, offset); + checkError(); } public void glGetBufferParameteriv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetBufferParameteriv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetBufferParameteriv(target, pname, params); + checkError(); } public void glGetClipPlanef(int pname, float[] eqn, int offset) { - throw new UnsupportedOperationException(); + begin("glGetClipPlanef"); + arg("pname", pname); + arg("eqn", eqn.toString()); + arg("offset", offset); + end(); + mgl11.glGetClipPlanef(pname, eqn, offset); + checkError(); } public void glGetClipPlanef(int pname, FloatBuffer eqn) { - throw new UnsupportedOperationException(); + begin("glGetClipPlanef"); + arg("pname", pname); + arg("eqn", eqn.toString()); + end(); + mgl11.glGetClipPlanef(pname, eqn); + checkError(); } public void glGetClipPlanex(int pname, int[] eqn, int offset) { - throw new UnsupportedOperationException(); + begin("glGetClipPlanex"); + arg("pname", pname); + arg("eqn", eqn.toString()); + arg("offset", offset); + end(); + mgl11.glGetClipPlanex(pname, eqn, offset); } public void glGetClipPlanex(int pname, IntBuffer eqn) { - throw new UnsupportedOperationException(); + begin("glGetClipPlanex"); + arg("pname", pname); + arg("eqn", eqn.toString()); + end(); + mgl11.glGetClipPlanex(pname, eqn); + checkError(); } public void glGetFixedv(int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetFixedv"); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetFixedv(pname, params, offset); } public void glGetFixedv(int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetFixedv"); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetFixedv(pname, params); + checkError(); } public void glGetFloatv(int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetFloatv"); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetFloatv(pname, params, offset); } public void glGetFloatv(int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetFloatv"); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetFloatv(pname, params); + checkError(); } public void glGetLightfv(int light, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetLightfv"); + arg("light", light); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetLightfv(light, pname, params, offset); + checkError(); } public void glGetLightfv(int light, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetLightfv"); + arg("light", light); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetLightfv(light, pname, params); + checkError(); } public void glGetLightxv(int light, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetLightxv"); + arg("light", light); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetLightxv(light, pname, params, offset); + checkError(); } public void glGetLightxv(int light, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetLightxv"); + arg("light", light); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetLightxv(light, pname, params); + checkError(); } - public void glGetMaterialfv(int face, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); + public void glGetMaterialfv(int face, int pname, float[] params, + int offset) { + begin("glGetMaterialfv"); + arg("face", face); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetMaterialfv(face, pname, params, offset); + checkError(); } public void glGetMaterialfv(int face, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetMaterialfv"); + arg("face", face); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetMaterialfv(face, pname, params); + checkError(); } public void glGetMaterialxv(int face, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetMaterialxv"); + arg("face", face); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetMaterialxv(face, pname, params, offset); + checkError(); } public void glGetMaterialxv(int face, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetMaterialxv"); + arg("face", face); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetMaterialxv(face, pname, params); + checkError(); } public void glGetTexEnviv(int env, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetTexEnviv"); + arg("env", env); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetTexEnviv(env, pname, params, offset); + checkError(); } public void glGetTexEnviv(int env, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetTexEnviv"); + arg("env", env); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetTexEnviv(env, pname, params); + checkError(); } public void glGetTexEnvxv(int env, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetTexEnviv"); + arg("env", env); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetTexEnviv(env, pname, params, offset); + checkError(); } public void glGetTexEnvxv(int env, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetTexEnviv"); + arg("env", env); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetTexEnvxv(env, pname, params); + checkError(); } public void glGetTexParameterfv(int target, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetTexParameterfv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetTexParameterfv(target, pname, params, offset); + checkError(); } public void glGetTexParameterfv(int target, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetTexParameterfv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetTexParameterfv(target, pname, params); + checkError(); } public void glGetTexParameteriv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glGetTexParameteriv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetTexEnviv(target, pname, params, offset); + checkError(); } public void glGetTexParameteriv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetTexParameteriv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetTexParameteriv(target, pname, params); + checkError(); } - public void glGetTexParameterxv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + public void glGetTexParameterxv(int target, int pname, int[] params, + int offset) { + begin("glGetTexParameterxv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glGetTexParameterxv(target, pname, params, offset); + checkError(); } public void glGetTexParameterxv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glGetTexParameterxv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetTexParameterxv(target, pname, params); + checkError(); } public boolean glIsBuffer(int buffer) { - throw new UnsupportedOperationException(); + begin("glIsBuffer"); + arg("buffer", buffer); + end(); + boolean result = mgl11.glIsBuffer(buffer); + checkError(); + return result; } public boolean glIsEnabled(int cap) { - throw new UnsupportedOperationException(); + begin("glIsEnabled"); + arg("cap", cap); + end(); + boolean result = mgl11.glIsEnabled(cap); + checkError(); + return result; } public boolean glIsTexture(int texture) { - throw new UnsupportedOperationException(); + begin("glIsTexture"); + arg("texture", texture); + end(); + boolean result = mgl11.glIsTexture(texture); + checkError(); + return result; } public void glPointParameterf(int pname, float param) { - throw new UnsupportedOperationException(); + begin("glPointParameterf"); + arg("pname", pname); + arg("param", param); + end(); + mgl11.glPointParameterf( pname, param); + checkError(); } public void glPointParameterfv(int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glPointParameterfv"); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glPointParameterfv(pname, params, offset); + checkError(); } public void glPointParameterfv(int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); + begin("glPointParameterfv"); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glPointParameterfv(pname, params); + checkError(); } public void glPointParameterx(int pname, int param) { - throw new UnsupportedOperationException(); + begin("glPointParameterfv"); + arg("pname", pname); + arg("param", param); + end(); + mgl11.glPointParameterx( pname, param); + checkError(); } public void glPointParameterxv(int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glPointParameterxv"); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glPointParameterxv(pname, params, offset); + checkError(); } public void glPointParameterxv(int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glPointParameterxv"); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glPointParameterxv( pname, params); + checkError(); } public void glPointSizePointerOES(int type, int stride, Buffer pointer) { - throw new UnsupportedOperationException(); + begin("glPointSizePointerOES"); + arg("type", type); + arg("stride", stride); + arg("params", pointer.toString()); + end(); + mgl11.glPointSizePointerOES( type, stride, pointer); + checkError(); } public void glTexEnvi(int target, int pname, int param) { - throw new UnsupportedOperationException(); + begin("glTexEnvi"); + arg("target", target); + arg("pname", pname); + arg("param", param); + end(); + mgl11.glTexEnvi(target, pname, param); + checkError(); } public void glTexEnviv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + begin("glTexEnviv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glTexEnviv(target, pname, params, offset); + checkError(); } public void glTexEnviv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glTexEnviv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glTexEnviv( target, pname, params); + checkError(); } - public void glTexParameterfv(int target, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); + public void glTexParameterfv(int target, int pname, float[] params, + int offset) { + begin("glTexParameterfv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glTexParameterfv( target, pname, params, offset); + checkError(); } public void glTexParameterfv(int target, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); + begin("glTexParameterfv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glTexParameterfv(target, pname, params); + checkError(); } public void glTexParameteri(int target, int pname, int param) { - throw new UnsupportedOperationException(); + begin("glTexParameterxv"); + arg("target", target); + arg("pname", pname); + arg("param", param); + end(); + mgl11.glTexParameteri(target, pname, param); + checkError(); } - public void glTexParameterxv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); + public void glTexParameterxv(int target, int pname, int[] params, + int offset) { + begin("glTexParameterxv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + arg("offset", offset); + end(); + mgl11.glTexParameterxv(target, pname, params, offset); + checkError(); } public void glTexParameterxv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); + begin("glTexParameterxv"); + arg("target", target); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glTexParameterxv(target, pname, params); + checkError(); + } + + + public void glColorPointer(int size, int type, int stride, int offset) { + begin("glColorPointer"); + arg("size", size); + arg("type", type); + arg("stride", stride); + arg("offset", offset); + end(); + mgl11.glColorPointer(size, type, stride, offset); + checkError(); + } + + public void glDrawElements(int mode, int count, int type, int offset) { + begin("glDrawElements"); + arg("mode", mode); + arg("count", count); + arg("type", type); + arg("offset", offset); + end(); + mgl11.glDrawElements(mode, count, type, offset); + checkError(); + } + + public void glGetPointerv(int pname, Buffer[] params) { + begin("glGetPointerv"); + arg("pname", pname); + arg("params", params.toString()); + end(); + mgl11.glGetPointerv(pname, params); + checkError(); + } + + public void glNormalPointer(int type, int stride, int offset) { + begin("glNormalPointer"); + arg("type", type); + arg("stride", stride); + arg("offset", offset); + end(); + mgl11.glNormalPointer(type, stride, offset); + } + + public void glTexCoordPointer(int size, int type, int stride, int offset) { + begin("glTexCoordPointer"); + arg("size", size); + arg("type", type); + arg("stride", stride); + arg("offset", offset); + end(); + mgl11.glTexCoordPointer(size, type, stride, offset); + } + + public void glVertexPointer(int size, int type, int stride, int offset) { + begin("glVertexPointer"); + arg("size", size); + arg("type", type); + arg("stride", stride); + arg("offset", offset); + end(); + mgl11.glVertexPointer(size, type, stride, offset); + } + + public void glCurrentPaletteMatrixOES(int matrixpaletteindex) { + begin("glCurrentPaletteMatrixOES"); + arg("matrixpaletteindex", matrixpaletteindex); + end(); + mgl11Ext.glCurrentPaletteMatrixOES(matrixpaletteindex); + checkError(); + } + + public void glLoadPaletteFromModelViewMatrixOES() { + begin("glLoadPaletteFromModelViewMatrixOES"); + end(); + mgl11Ext.glLoadPaletteFromModelViewMatrixOES(); + checkError(); + } + + public void glMatrixIndexPointerOES(int size, int type, int stride, + Buffer pointer) { + begin("glMatrixIndexPointerOES"); + argPointer(size, type, stride, pointer); + end(); + mgl11Ext.glMatrixIndexPointerOES(size, type, stride, pointer); + checkError(); + } + + public void glMatrixIndexPointerOES(int size, int type, int stride, + int offset) { + begin("glMatrixIndexPointerOES"); + arg("size", size); + arg("type", type); + arg("stride", stride); + arg("offset", offset); + end(); + mgl11Ext.glMatrixIndexPointerOES(size, type, stride, offset); + checkError(); + } + + public void glWeightPointerOES(int size, int type, int stride, + Buffer pointer) { + begin("glWeightPointerOES"); + argPointer(size, type, stride, pointer); + end(); + mgl11Ext.glWeightPointerOES(size, type, stride, pointer); + checkError(); + } + + public void glWeightPointerOES(int size, int type, int stride, int offset) { + begin("glWeightPointerOES"); + arg("size", size); + arg("type", type); + arg("stride", stride); + arg("offset", offset); + end(); + mgl11Ext.glWeightPointerOES(size, type, stride, offset); + checkError(); } private class PointerInfo { @@ -3010,6 +3464,9 @@ class GLLogWrapper extends GLWrapperBase { public Buffer mPointer; public ByteBuffer mTempByteBuffer; // Only valid during glDrawXXX calls + public PointerInfo() { + } + public PointerInfo(int size, int type, int stride, Buffer pointer) { mSize = size; mType = type; @@ -3039,7 +3496,7 @@ class GLLogWrapper extends GLWrapperBase { } public void bindByteBuffer() { - mTempByteBuffer = toByteBuffer(-1, mPointer); + mTempByteBuffer = mPointer == null ? null : toByteBuffer(-1, mPointer); } public void unbindByteBuffer() { @@ -3051,10 +3508,10 @@ class GLLogWrapper extends GLWrapperBase { private boolean mLogArgumentNames; private int mArgCount; - private PointerInfo mColorPointer; - private PointerInfo mNormalPointer; - private PointerInfo mTexCoordPointer; - private PointerInfo mVertexPointer; + private PointerInfo mColorPointer = new PointerInfo(); + private PointerInfo mNormalPointer = new PointerInfo(); + private PointerInfo mTexCoordPointer = new PointerInfo(); + private PointerInfo mVertexPointer = new PointerInfo(); boolean mColorArrayEnabled; boolean mNormalArrayEnabled; diff --git a/opengl/java/android/opengl/GLSurfaceView.java b/opengl/java/android/opengl/GLSurfaceView.java index c458a7a..185398b 100644 --- a/opengl/java/android/opengl/GLSurfaceView.java +++ b/opengl/java/android/opengl/GLSurfaceView.java @@ -398,7 +398,6 @@ public class GLSurfaceView extends SurfaceView implements SurfaceHolder.Callback * {@link #setEGLConfigChooser(EGLConfigChooser)} has been called, then the supplied * EGLConfigChooser is responsible for choosing an OpenGL ES 2.0-compatible config. * @param version The EGLContext client version to choose. Use 2 for OpenGL ES 2.0 - * @hide */ public void setEGLContextClientVersion(int version) { checkRenderThreadState(); diff --git a/opengl/java/android/opengl/GLU.java b/opengl/java/android/opengl/GLU.java index 49a43d0..ed64556 100644 --- a/opengl/java/android/opengl/GLU.java +++ b/opengl/java/android/opengl/GLU.java @@ -72,60 +72,12 @@ public class GLU { float centerX, float centerY, float centerZ, float upX, float upY, float upZ) { - // See the OpenGL GLUT documentation for gluLookAt for a description - // of the algorithm. We implement it in a straightforward way: - - float fx = centerX - eyeX; - float fy = centerY - eyeY; - float fz = centerZ - eyeZ; - - // Normalize f - float rlf = 1.0f / Matrix.length(fx, fy, fz); - fx *= rlf; - fy *= rlf; - fz *= rlf; - - // compute s = f x up (x means "cross product") - float sx = fy * upZ - fz * upY; - float sy = fz * upX - fx * upZ; - float sz = fx * upY - fy * upX; - - // and normalize s - float rls = 1.0f / Matrix.length(sx, sy, sz); - sx *= rls; - sy *= rls; - sz *= rls; - - // compute u = s x f - float ux = sy * fz - sz * fy; - float uy = sz * fx - sx * fz; - float uz = sx * fy - sy * fx; - float[] scratch = sScratch; synchronized(scratch) { - scratch[0] = sx; - scratch[1] = ux; - scratch[2] = -fx; - scratch[3] = 0.0f; - - scratch[4] = sy; - scratch[5] = uy; - scratch[6] = -fy; - scratch[7] = 0.0f; - - scratch[8] = sz; - scratch[9] = uz; - scratch[10] = -fz; - scratch[11] = 0.0f; - - scratch[12] = 0.0f; - scratch[13] = 0.0f; - scratch[14] = 0.0f; - scratch[15] = 1.0f; - + Matrix.setLookAtM(scratch, 0, eyeX, eyeY, eyeZ, centerX, centerY, centerZ, + upX, upY, upZ); gl.glMultMatrixf(scratch, 0); } - gl.glTranslatef(-eyeX, -eyeY, -eyeZ); } /** diff --git a/opengl/java/android/opengl/GLWrapperBase.java b/opengl/java/android/opengl/GLWrapperBase.java index 067f95f..b0f83f7 100644 --- a/opengl/java/android/opengl/GLWrapperBase.java +++ b/opengl/java/android/opengl/GLWrapperBase.java @@ -16,9 +16,6 @@ package android.opengl; -import java.nio.Buffer; -import java.nio.FloatBuffer; -import java.nio.IntBuffer; import javax.microedition.khronos.opengles.GL; import javax.microedition.khronos.opengles.GL10; import javax.microedition.khronos.opengles.GL10Ext; @@ -32,464 +29,25 @@ import javax.microedition.khronos.opengles.GL11ExtensionPack; */ abstract class GLWrapperBase implements GL, GL10, GL10Ext, GL11, GL11Ext { - public GLWrapperBase(GL gl) { - mgl = (GL10) gl; - if (gl instanceof GL10Ext) { - mgl10Ext = (GL10Ext) gl; - } - if (gl instanceof GL11) { - mgl11 = (GL11) gl; - } - if (gl instanceof GL11Ext) { - mgl11Ext = (GL11Ext) gl; - } - if (gl instanceof GL11ExtensionPack) { - mgl11ExtensionPack = (GL11ExtensionPack) gl; - } - } - - protected GL10 mgl; - protected GL10Ext mgl10Ext; - protected GL11 mgl11; - protected GL11Ext mgl11Ext; - protected GL11ExtensionPack mgl11ExtensionPack; - - // Unsupported GL11 methods - - public void glGetPointerv(int pname, java.nio.Buffer[] params) { - throw new UnsupportedOperationException(); - } - - // VBO versions of *Pointer and *Elements methods - public void glColorPointer(int size, int type, int stride, int offset) { - throw new UnsupportedOperationException(); - } - - public void glNormalPointer(int type, int stride, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexCoordPointer(int size, int type, int stride, int offset) { - throw new UnsupportedOperationException(); - } - - public void glVertexPointer(int size, int type, int stride, int offset) { - throw new UnsupportedOperationException(); - } - - public void glDrawElements(int mode, int count, int type, int offset) { - throw new UnsupportedOperationException(); - } - - public void glBindBuffer(int target, int buffer) { - throw new UnsupportedOperationException(); - } - - public void glBufferData(int target, int size, Buffer data, int usage) { - throw new UnsupportedOperationException(); - } - - public void glBufferSubData(int target, int offset, int size, Buffer data) { - throw new UnsupportedOperationException(); - } - - public void glColor4ub(byte red, byte green, byte blue, byte alpha) { - throw new UnsupportedOperationException(); - } - - public void glDeleteBuffers(int n, int[] buffers, int offset) { - throw new UnsupportedOperationException(); - } - - public void glDeleteBuffers(int n, IntBuffer buffers) { - throw new UnsupportedOperationException(); - } - - public void glGenBuffers(int n, int[] buffers, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGenBuffers(int n, IntBuffer buffers) { - throw new UnsupportedOperationException(); - } - - public void glGetBooleanv(int pname, boolean[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetBooleanv(int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetBufferParameteriv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetBufferParameteriv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetClipPlanef(int pname, float[] eqn, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetClipPlanef(int pname, FloatBuffer eqn) { - throw new UnsupportedOperationException(); - } - - public void glGetClipPlanex(int pname, int[] eqn, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetClipPlanex(int pname, IntBuffer eqn) { - throw new UnsupportedOperationException(); - } - - public void glGetFixedv(int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetFixedv(int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetFloatv(int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetFloatv(int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetLightfv(int light, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetLightfv(int light, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetLightxv(int light, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetLightxv(int light, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetMaterialfv(int face, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetMaterialfv(int face, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetMaterialxv(int face, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetMaterialxv(int face, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexEnviv(int env, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexEnviv(int env, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexEnvxv(int env, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexEnvxv(int env, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexParameterfv(int target, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexParameterfv(int target, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexParameteriv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexParameteriv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexParameterxv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexParameterxv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public boolean glIsBuffer(int buffer) { - throw new UnsupportedOperationException(); - } - - public boolean glIsEnabled(int cap) { - throw new UnsupportedOperationException(); - } - - public boolean glIsTexture(int texture) { - throw new UnsupportedOperationException(); - } - - public void glPointParameterf(int pname, float param) { - throw new UnsupportedOperationException(); - } - - public void glPointParameterfv(int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glPointParameterfv(int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glPointParameterx(int pname, int param) { - throw new UnsupportedOperationException(); - } - - public void glPointParameterxv(int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glPointParameterxv(int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glPointSizePointerOES(int type, int stride, Buffer pointer) { - throw new UnsupportedOperationException(); - } - - public void glTexEnvi(int target, int pname, int param) { - throw new UnsupportedOperationException(); - } - - public void glTexEnviv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexEnviv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glTexParameterfv(int target, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexParameterfv(int target, int pname, FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glTexParameteri(int target, int pname, int param) { - throw new UnsupportedOperationException(); - } - - public void glTexParameterxv(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexParameterxv(int target, int pname, IntBuffer params) { - throw new UnsupportedOperationException(); - } - - // Unsupported GL11Ext methods - - public void glCurrentPaletteMatrixOES(int matrixpaletteindex) { - throw new UnsupportedOperationException(); - } - - public void glLoadPaletteFromModelViewMatrixOES() { - throw new UnsupportedOperationException(); - } - - public void glMatrixIndexPointerOES(int size, int type, int stride, Buffer pointer) { - throw new UnsupportedOperationException(); - } - - public void glMatrixIndexPointerOES(int size, int type, int stride, int offset) { - throw new UnsupportedOperationException(); - } - - public void glWeightPointerOES(int size, int type, int stride, Buffer pointer) { - throw new UnsupportedOperationException(); - } - - public void glWeightPointerOES(int size, int type, int stride, int offset) { - throw new UnsupportedOperationException(); - } - - // Unsupported GL11ExtensionPack methods - - public void glBindFramebufferOES(int target, int framebuffer) { - throw new UnsupportedOperationException(); - } - - public void glBindRenderbufferOES(int target, int renderbuffer) { - throw new UnsupportedOperationException(); - } - - public void glBlendEquation(int mode) { - throw new UnsupportedOperationException(); - } - - public void glBlendEquationSeparate(int modeRGB, int modeAlpha) { - throw new UnsupportedOperationException(); - } - - public void glBlendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) { - throw new UnsupportedOperationException(); - } - - int glCheckFramebufferStatusOES(int target) { - throw new UnsupportedOperationException(); - } - - public void glCompressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, int imageSize) { - throw new UnsupportedOperationException(); - } - - public void glDeleteFramebuffersOES(int n, int[] framebuffers, int offset) { - throw new UnsupportedOperationException(); - } - - public void glDeleteFramebuffersOES(int n, java.nio.IntBuffer framebuffers) { - throw new UnsupportedOperationException(); - } - - public void glDeleteRenderbuffersOES(int n, int[] renderbuffers, int offset) { - throw new UnsupportedOperationException(); - } - - public void glDeleteRenderbuffersOES(int n, java.nio.IntBuffer renderbuffers) { - throw new UnsupportedOperationException(); - } - - public void glFramebufferRenderbufferOES(int target, int attachment, int renderbuffertarget, int renderbuffer) { - throw new UnsupportedOperationException(); - } - - public void glFramebufferTexture2DOES(int target, int attachment, int textarget, int texture, int level) { - throw new UnsupportedOperationException(); - } - - public void glGenerateMipmapOES(int target) { - throw new UnsupportedOperationException(); - } - - public void glGenFramebuffersOES(int n, int[] framebuffers, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGenFramebuffersOES(int n, java.nio.IntBuffer framebuffers) { - throw new UnsupportedOperationException(); - } - - public void glGenRenderbuffersOES(int n, int[] renderbuffers, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGenRenderbuffersOES(int n, java.nio.IntBuffer renderbuffers) { - throw new UnsupportedOperationException(); - } - - public void glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetFramebufferAttachmentParameterivOES(int target, int attachment, int pname, java.nio.IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetRenderbufferParameterivOES(int target, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetRenderbufferParameterivOES(int target, int pname, java.nio.IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexGenfv(int coord, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexGenfv(int coord, int pname, java.nio.FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexGeniv(int coord, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexGeniv(int coord, int pname, java.nio.IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glGetTexGenxv(int coord, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glGetTexGenxv(int coord, int pname, java.nio.IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public boolean glIsFramebufferOES(int framebuffer) { - throw new UnsupportedOperationException(); - } - - public boolean glIsRenderbufferOES(int renderbuffer) { - throw new UnsupportedOperationException(); - } - - public void glRenderbufferStorageOES(int target, int internalformat, int width, int height) { - throw new UnsupportedOperationException(); - } - - public void glTexGenf(int coord, int pname, float param) { - throw new UnsupportedOperationException(); - } - - public void glTexGenfv(int coord, int pname, float[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexGenfv(int coord, int pname, java.nio.FloatBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glTexGeni(int coord, int pname, int param) { - throw new UnsupportedOperationException(); - } - - public void glTexGeniv(int coord, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexGeniv(int coord, int pname, java.nio.IntBuffer params) { - throw new UnsupportedOperationException(); - } - - public void glTexGenx(int coord, int pname, int param) { - throw new UnsupportedOperationException(); - } - - public void glTexGenxv(int coord, int pname, int[] params, int offset) { - throw new UnsupportedOperationException(); - } - - public void glTexGenxv(int coord, int pname, java.nio.IntBuffer params) { - throw new UnsupportedOperationException(); - } + public GLWrapperBase(GL gl) { + mgl = (GL10) gl; + if (gl instanceof GL10Ext) { + mgl10Ext = (GL10Ext) gl; + } + if (gl instanceof GL11) { + mgl11 = (GL11) gl; + } + if (gl instanceof GL11Ext) { + mgl11Ext = (GL11Ext) gl; + } + if (gl instanceof GL11ExtensionPack) { + mgl11ExtensionPack = (GL11ExtensionPack) gl; + } + } + + protected GL10 mgl; + protected GL10Ext mgl10Ext; + protected GL11 mgl11; + protected GL11Ext mgl11Ext; + protected GL11ExtensionPack mgl11ExtensionPack; } diff --git a/opengl/java/android/opengl/Matrix.java b/opengl/java/android/opengl/Matrix.java index 13ba36e..b9fd4ab 100644 --- a/opengl/java/android/opengl/Matrix.java +++ b/opengl/java/android/opengl/Matrix.java @@ -16,6 +16,8 @@ package android.opengl; +import javax.microedition.khronos.opengles.GL10; + /** * Matrix math utilities. These methods operate on OpenGL ES format * matrices and vectors stored in float arrays. @@ -582,4 +584,77 @@ public class Matrix { rm[rmOffset + 14] = 0.0f; rm[rmOffset + 15] = 1.0f; } + + /** + * Define a viewing transformation in terms of an eye point, a center of + * view, and an up vector. + * + * @param rm returns the result + * @param rmOffset index into rm where the result matrix starts + * @param eyeX eye point X + * @param eyeY eye point Y + * @param eyeZ eye point Z + * @param centerX center of view X + * @param centerY center of view Y + * @param centerZ center of view Z + * @param upX up vector X + * @param upY up vector Y + * @param upZ up vector Z + */ + public static void setLookAtM(float[] rm, int rmOffset, + float eyeX, float eyeY, float eyeZ, + float centerX, float centerY, float centerZ, float upX, float upY, + float upZ) { + + // See the OpenGL GLUT documentation for gluLookAt for a description + // of the algorithm. We implement it in a straightforward way: + + float fx = centerX - eyeX; + float fy = centerY - eyeY; + float fz = centerZ - eyeZ; + + // Normalize f + float rlf = 1.0f / Matrix.length(fx, fy, fz); + fx *= rlf; + fy *= rlf; + fz *= rlf; + + // compute s = f x up (x means "cross product") + float sx = fy * upZ - fz * upY; + float sy = fz * upX - fx * upZ; + float sz = fx * upY - fy * upX; + + // and normalize s + float rls = 1.0f / Matrix.length(sx, sy, sz); + sx *= rls; + sy *= rls; + sz *= rls; + + // compute u = s x f + float ux = sy * fz - sz * fy; + float uy = sz * fx - sx * fz; + float uz = sx * fy - sy * fx; + + rm[rmOffset + 0] = sx; + rm[rmOffset + 1] = ux; + rm[rmOffset + 2] = -fx; + rm[rmOffset + 3] = 0.0f; + + rm[rmOffset + 4] = sy; + rm[rmOffset + 5] = uy; + rm[rmOffset + 6] = -fy; + rm[rmOffset + 7] = 0.0f; + + rm[rmOffset + 8] = sz; + rm[rmOffset + 9] = uz; + rm[rmOffset + 10] = -fz; + rm[rmOffset + 11] = 0.0f; + + rm[rmOffset + 12] = 0.0f; + rm[rmOffset + 13] = 0.0f; + rm[rmOffset + 14] = 0.0f; + rm[rmOffset + 15] = 1.0f; + + translateM(rm, rmOffset, -eyeX, -eyeY, -eyeZ); + } } diff --git a/opengl/java/com/google/android/gles_jni/GLImpl.java b/opengl/java/com/google/android/gles_jni/GLImpl.java index 36b6ea0..01a9c91 100644 --- a/opengl/java/com/google/android/gles_jni/GLImpl.java +++ b/opengl/java/com/google/android/gles_jni/GLImpl.java @@ -45,6 +45,9 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { Buffer _normalPointer = null; Buffer _texCoordPointer = null; Buffer _vertexPointer = null; + Buffer _pointSizePointerOES = null; + Buffer _matrixIndexPointerOES = null; + Buffer _weightPointerOES = null; public GLImpl() { } @@ -1582,12 +1585,31 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { // C function void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) - public native void glPointSizePointerOES( + private native void glPointSizePointerOESBounds( int type, int stride, - java.nio.Buffer pointer + java.nio.Buffer pointer, + int remaining ); + public void glPointSizePointerOES( + int type, + int stride, + java.nio.Buffer pointer + ) { + glPointSizePointerOESBounds( + type, + stride, + pointer, + pointer.remaining() + ); + if (((type == GL_FLOAT) || + (type == GL_FIXED)) && + (stride >= 0)) { + _pointSizePointerOES = pointer; + } + } + // C function void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) public native void glTexCoordPointer( @@ -1795,13 +1817,39 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) - public native void glMatrixIndexPointerOES( + private native void glMatrixIndexPointerOESBounds( int size, int type, int stride, - java.nio.Buffer pointer + java.nio.Buffer pointer, + int remaining ); + public void glMatrixIndexPointerOES( + int size, + int type, + int stride, + java.nio.Buffer pointer + ) { + glMatrixIndexPointerOESBounds( + size, + type, + stride, + pointer, + pointer.remaining() + ); + if (((size == 2) || + (size == 3) || + (size == 4)) && + ((type == GL_FLOAT) || + (type == GL_BYTE) || + (type == GL_SHORT) || + (type == GL_FIXED)) && + (stride >= 0)) { + _matrixIndexPointerOES = pointer; + } + } + // C function void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) public native void glMatrixIndexPointerOES( @@ -1813,13 +1861,29 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) - public native void glWeightPointerOES( + private native void glWeightPointerOESBounds( int size, int type, int stride, - java.nio.Buffer pointer + java.nio.Buffer pointer, + int remaining ); + public void glWeightPointerOES( + int size, + int type, + int stride, + java.nio.Buffer pointer + ) { + glWeightPointerOESBounds( + size, + type, + stride, + pointer, + pointer.remaining() + ); + } + // C function void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) public native void glWeightPointerOES( diff --git a/opengl/libagl/fixed_asm.S b/opengl/libagl/fixed_asm.S index 6cbc56f..05044f2 100644 --- a/opengl/libagl/fixed_asm.S +++ b/opengl/libagl/fixed_asm.S @@ -20,7 +20,9 @@ .align .global gglFloatToFixed + .type gglFloatToFixed, %function .global gglFloatToFixedFast + .type gglFloatToFixedFast, %function /* diff --git a/opengl/libagl/iterators.S b/opengl/libagl/iterators.S index daf2937..8c86482 100644 --- a/opengl/libagl/iterators.S +++ b/opengl/libagl/iterators.S @@ -21,6 +21,7 @@ .arm .global iterators0032 + .type iterators0032, %function /* * iterators0032 diff --git a/opengl/libs/GLES_CM/gl.cpp b/opengl/libs/GLES_CM/gl.cpp index 0c9352e..e7757a8 100644 --- a/opengl/libs/GLES_CM/gl.cpp +++ b/opengl/libs/GLES_CM/gl.cpp @@ -47,6 +47,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); } void glColorPointerBounds(GLint size, GLenum type, GLsizei stride, @@ -66,6 +72,21 @@ void glVertexPointerBounds(GLint size, GLenum type, glVertexPointer(size, type, stride, pointer); } +void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glPointSizePointerOES(type, stride, pointer); +} + +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glMatrixIndexPointerOES(size, type, stride, pointer); +} + +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glWeightPointerOES(size, type, stride, pointer); +} + // ---------------------------------------------------------------------------- // Actual GL entry-points // ---------------------------------------------------------------------------- diff --git a/opengl/tests/fillrate/Android.mk b/opengl/tests/fillrate/Android.mk index a7d30c2..191c59b 100644 --- a/opengl/tests/fillrate/Android.mk +++ b/opengl/tests/fillrate/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ + libutils \ libEGL \ libGLESv1_CM \ libui diff --git a/opengl/tests/finish/Android.mk b/opengl/tests/finish/Android.mk index 5620814..aa607c6 100644 --- a/opengl/tests/finish/Android.mk +++ b/opengl/tests/finish/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ + libutils \ libEGL \ libGLESv1_CM \ libui diff --git a/opengl/tests/swapinterval/Android.mk b/opengl/tests/swapinterval/Android.mk index 619447c..9a4145e 100644 --- a/opengl/tests/swapinterval/Android.mk +++ b/opengl/tests/swapinterval/Android.mk @@ -6,6 +6,7 @@ LOCAL_SRC_FILES:= \ LOCAL_SHARED_LIBRARIES := \ libcutils \ + libutils \ libEGL \ libGLESv1_CM \ libui diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec index 1468ab9..f917128 100644 --- a/opengl/tools/glgen/specs/gles11/checks.spec +++ b/opengl/tools/glgen/specs/gles11/checks.spec @@ -37,7 +37,6 @@ glBlendEquation unsupported glBlendEquationSeparate unsupported glBlendFuncSeparate unsupported glCheckFramebufferStatusOES unsupported return 0 -glCurrentPaletteMatrixOES unsupported glDeleteFramebuffersOES unsupported glDeleteRenderbuffersOES unsupported glFramebufferRenderbufferOES unsupported @@ -52,11 +51,8 @@ glGetRenderbufferParameterivOES unsupported glGetTexGen unsupported glIsFramebufferOES unsupported return JNI_FALSE glIsRenderbufferOES unsupported return JNI_FALSE -glLoadPaletteFromModelViewMatrixOES unsupported -glMatrixIndexPointerOES unsupported glRenderbufferStorageOES unsupported return false glTexGen unsupported glTexGenf unsupported glTexGeni unsupported glTexGenx unsupported -glWeightPointerOES unsupported diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks index 063cdc7..c28e403 100644 --- a/opengl/tools/glgen/specs/jsr239/glspec-checks +++ b/opengl/tools/glgen/specs/jsr239/glspec-checks @@ -35,7 +35,6 @@ glBlendEquation unsupported glBlendEquationSeparate unsupported glBlendFuncSeparate unsupported glCheckFramebufferStatusOES unsupported return 0 -glCurrentPaletteMatrixOES unsupported glDeleteFramebuffersOES unsupported glDeleteRenderbuffersOES unsupported glFramebufferRenderbufferOES unsupported @@ -50,11 +49,8 @@ glGetRenderbufferParameterivOES unsupported glGetTexGen unsupported glIsFramebufferOES unsupported return JNI_FALSE glIsRenderbufferOES unsupported return JNI_FALSE -glLoadPaletteFromModelViewMatrixOES unsupported -glMatrixIndexPointerOES unsupported glRenderbufferStorageOES unsupported return false glTexGen unsupported glTexGenf unsupported glTexGeni unsupported glTexGenx unsupported -glWeightPointerOES unsupported diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index 4c1814a..e79170a 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -119,10 +119,15 @@ public class JniCodeEmitter { emitFunction(jfunc, out, false, false); } + boolean isPointerFunc(JFunc jfunc) { + String name = jfunc.getName(); + return (name.endsWith("Pointer") || name.endsWith("PointerOES")) + && jfunc.getCFunc().hasPointerArg(); + } + void emitFunctionCall(JFunc jfunc, PrintStream out, String iii, boolean grabArray) { boolean isVoid = jfunc.getType().isVoid(); - boolean isPointerFunc = jfunc.getName().endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); if (!isVoid) { out.println(iii + @@ -406,9 +411,7 @@ public class JniCodeEmitter { * if !interfaceDecl: public <returntype> func(args) { body } */ void emitFunction(JFunc jfunc, PrintStream out, boolean nativeDecl, boolean interfaceDecl) { - boolean isPointerFunc = - jfunc.getName().endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); if (!nativeDecl && !interfaceDecl && !isPointerFunc) { // If it's not a pointer function, we've already emitted it @@ -510,6 +513,34 @@ public class JniCodeEmitter { out.println(iii + " (stride >= 0)) {"); out.println(iii + indent + "_vertexPointer = pointer;"); out.println(iii + "}"); + } else if (fname.equals("glPointSizePointerOES")) { + out.println(iii + "if (((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_pointSizePointerOES = pointer;"); + out.println(iii + "}"); + } else if (fname.equals("glMatrixIndexPointerOES")) { + out.println(iii + "if (((size == 2) ||"); + out.println(iii + " (size == 3) ||"); + out.println(iii + " (size == 4)) &&"); + out.println(iii + " ((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_BYTE) ||"); + out.println(iii + " (type == GL_SHORT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_matrixIndexPointerOES = pointer;"); + out.println(iii + "}"); + } else if (fname.equals("glWeightPointer")) { + out.println(iii + "if (((size == 2) ||"); + out.println(iii + " (size == 3) ||"); + out.println(iii + " (size == 4)) &&"); + out.println(iii + " ((type == GL_FLOAT) ||"); + out.println(iii + " (type == GL_BYTE) ||"); + out.println(iii + " (type == GL_SHORT) ||"); + out.println(iii + " (type == GL_FIXED)) &&"); + out.println(iii + " (stride >= 0)) {"); + out.println(iii + indent + "_weightPointerOES = pointer;"); + out.println(iii + "}"); } } @@ -609,9 +640,9 @@ public class JniCodeEmitter { // String outName = "android_" + jfunc.getName(); - boolean isPointerFunc = outName.endsWith("Pointer") && - jfunc.getCFunc().hasPointerArg(); + boolean isPointerFunc = isPointerFunc(jfunc); boolean isVBOPointerFunc = (outName.endsWith("Pointer") || + outName.endsWith("PointerOES") || outName.endsWith("DrawElements")) && !jfunc.getCFunc().hasPointerArg(); if (isPointerFunc) { diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if index 428ccee..c5e34cd 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if @@ -18,6 +18,8 @@ package android.opengl; +import java.nio.Buffer; + public class GLES11Ext { public static final int GL_BLEND_EQUATION_RGB_OES = 0x8009; public static final int GL_BLEND_EQUATION_ALPHA_OES = 0x883D; @@ -127,4 +129,10 @@ public class GLES11Ext { static { _nativeClassInit(); } -
\ No newline at end of file + + private static final int GL_BYTE = GLES10.GL_BYTE; + private static final int GL_FIXED = GLES10.GL_FIXED; + private static final int GL_FLOAT = GLES10.GL_FLOAT; + private static final int GL_SHORT = GLES10.GL_SHORT; + + private static Buffer _matrixIndexPointerOES;
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp index 294d1ce..2548b32 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp @@ -23,6 +23,15 @@ #include <GLES/gl.h> #include <GLES/glext.h> +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +} + static int initialized = 0; static jclass nioAccessClass; @@ -121,5 +130,17 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) commit ? 0 : JNI_ABORT); } +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} // -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if index 26f466f..81572d2 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if @@ -149,3 +149,4 @@ public class GLES11 extends GLES10 { _nativeClassInit(); } + private static Buffer _pointSizePointerOES; diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp index 294d1ce..4c297f7 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp @@ -23,6 +23,13 @@ #include <GLES/gl.h> #include <GLES/glext.h> +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +} + static int initialized = 0; static jclass nioAccessClass; @@ -121,5 +128,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) commit ? 0 : JNI_ABORT); } +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} + // -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if index 7504509..b615e0a 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if @@ -19,7 +19,6 @@ package android.opengl; /** OpenGL ES 2.0 - * @hide */ public class GLES20 { public static final int GL_ACTIVE_TEXTURE = 0x84E0; diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp index 4494643..b3d1c6c 100644 --- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp +++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp @@ -34,6 +34,12 @@ GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); } static int initialized = 0; diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl index fe60c5d..76fea3f 100644 --- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl +++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl @@ -44,6 +44,9 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack { Buffer _normalPointer = null; Buffer _texCoordPointer = null; Buffer _vertexPointer = null; + Buffer _pointSizePointerOES = null; + Buffer _matrixIndexPointerOES = null; + Buffer _weightPointerOES = null; public GLImpl() { } |
