There's a function that gets the current matrix in OpenGL.

But there's no such function in OpenGL ES.

So I take a look at the API Demo app bundled with the SDK and found
"MatrixGrabber".java with the getCurrentModelView function.

But... when I try to use it in my project, I got an error at this
line:

public void getCurrentModelView(GL10 gl) {
        getMatrix(gl, GL10.GL_MODELVIEW, mModelView);
}

private void getMatrix(GL10 gl, int mode, float[] mat) {
        MatrixTrackingGL gl2 = (MatrixTrackingGL) gl;     // error at
this line
        gl2.glMatrixMode(mode);
        gl2.getMatrix(mat, 0);
 }

The error log was:
08-02 18:49:07.063: WARN/dalvikvm(1403): threadid=13: thread exiting
with uncaught exception (group=0x4000fe70)
08-02 18:49:07.063: ERROR/AndroidRuntime(1403): Uncaught handler:
thread GLThread exiting due to uncaught exception
08-02 18:49:07.063: ERROR/AndroidRuntime(1403):
java.lang.ClassCastException: android.opengl.GLErrorWrapper
08-02 18:49:07.063: ERROR/AndroidRuntime(1403):     at
com.test.app.MatrixGrabber.getMatrix(MatrixGrabber.java:56)
08-02 18:49:07.063: ERROR/AndroidRuntime(1403):     at
com.test.app.MatrixGrabber.getCurrentModelView(MatrixGrabber.java:43)
08-02 18:49:07.063: ERROR/AndroidRuntime(1403):     at
com.test.app.MyRenderer.onDrawFrame(MyRenderer.java:454)


Here's MyRenderer.java's onDrawFrame() code:

        public void onDrawFrame(GL10 gl) {
        //Init
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
                gl.glMatrixMode(GL10.GL_MODELVIEW);
                gl.glLoadIdentity();
                mGrabber.getCurrentModelView(gl);


What did I do wrong? This method runs fine in API Demo. It accept the
GL10 object like I did in my project.

Thank you in advance. =)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to