diff options
author | Jack Palevich <jackpal@google.com> | 2009-12-08 15:43:51 +0800 |
---|---|---|
committer | Jack Palevich <jackpal@google.com> | 2009-12-08 15:43:51 +0800 |
commit | be6eac828f5af8b608c3fa6749330f1dcd6b6206 (patch) | |
tree | 8e34bfeec9ea1f57a5022f48be43e3a7b09859eb /opengl/java/com/google/android | |
parent | e35cfda3ae0be72a4ca1a18a81bf51fad901709a (diff) | |
download | frameworks_base-be6eac828f5af8b608c3fa6749330f1dcd6b6206.zip frameworks_base-be6eac828f5af8b608c3fa6749330f1dcd6b6206.tar.gz frameworks_base-be6eac828f5af8b608c3fa6749330f1dcd6b6206.tar.bz2 |
Implement Matrix Palette extension.
Adds support for formerly-unimplemented methods:
glCurrentPaletteMatrixOES
glLoadPaletteFromModelViewMatrixOES
glMatrixIndexPointerOES
glWeightPointerOES
The bulk of the changes are related to implementing the two PointerOES
methods, which are implemented pretty much the same way as the existing
Pointer methods were implemented.
This change also changes the way glPointSizePointerOES is implemented,
making it act like all the other Pointer methods. (Previously it was
not handling non-direct-buffer arguments correctly.)
Fixes bug 2308625 "Support matrix palette skinning
in JSR239 and related APIs"
Also updated GLLogWraper to fix two bugs in GLLogWrapper that were
discovered while testing matrix palette skinning support:
a) Handle trying to print the contents of null-but-enabled buffers.
(It's not legal to draw with null-but-enabled buffers, and
in fact some OpenGL drivers will crash if you try to render in this
state, but there's no reason the GLLogWrapper should crash while trying
to debug this situation.
b) Don't read off the end of a vertex buffer with non-zero position when
printing the entire contents of the vertex buffer. Now we only print from
the current position to the end of the buffer.
Diffstat (limited to 'opengl/java/com/google/android')
-rw-r--r-- | opengl/java/com/google/android/gles_jni/GLImpl.java | 76 |
1 files changed, 70 insertions, 6 deletions
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( |