Friday, February 17, 2012

[android-developers] Problems with MatrixGrabber: java.lang.ClassCastException: com.google.android.gles_jni.GLImpl

I have a GLSurfaceView class that must show a square with a texture.
I'm trying to fit the screen with the texture/polygon dimensions, then
i need to use projections.

I'm using 3 classes to have compatibility with android 1.5:

MatrixGrabber.java MatrixStack.java MatrixTrackingGL.java

This is the part of the code that it is giving the error:

private MatrixGrabber mg = new MatrixGrabber(); //create the matrix
grabber object in your initialization code
.
.
.
DisplayMetrics dm = new DisplayMetrics();

((Activity)context).getWindowManager().getDefaultDisplay().getMetrics(dm);
screenW=dm.widthPixels;
screenH=dm.heightPixels;

modelMatrix=mg.mModelView;
projMatrix=mg.mProjection;
mView[0] = 0;
mView[1] = 0;
mView[2] = screenW; //width
mView[3] = screenH; //height
.
.
.
public void onDrawFrame(GL10 gl) {
//Clear Screen And Depth Buffer
gl.glClear(GL10.GL_COLOR_BUFFER_BIT |
GL10.GL_DEPTH_BUFFER_BIT);
gl.glLoadIdentity(); //Reset The Current
Modelview Matrix

mg.getCurrentProjection(gl);
mg.getCurrentModelView(gl);
.
.
.

And this is the error:

02-17 09:13:59.952: WARN/dalvikvm(11405): threadid=8: thread
exiting with uncaught exception (group=0x4001d7e0)
02-17 09:13:59.960: ERROR/AndroidRuntime(11405): FATAL EXCEPTION:
GLThread 9
02-17 09:13:59.960: ERROR/AndroidRuntime(11405):
java.lang.ClassCastException: com.google.android.gles_jni.GLImpl
02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at
com.DemoMagazine.MatrixGrabber.getMatrix(MatrixGrabber.java:56)
02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at
com.DemoMagazine.MatrixGrabber.getCurrentProjection(MatrixGrabber.java:
52)
02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at
com.DemoMagazine.SquareGLSurfaceView.onDrawFrame(SquareGLSurfaceView.java:
112)
02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at
android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:
1332)
02-17 09:13:59.960: ERROR/AndroidRuntime(11405): at
android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment