• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps OpenGL and ModelView Matrix

mr87

Lurker
I need to find the ModelView matrix of a current 3d object. Every method I found uses C and those functions do not exist in Java. Anyone knows how to find it in Java for android.

Thanks
 
You do it more or less the same way you'd do it in C, and those functions do exist in Java, but the device you're using has to support GL ES 1.1 (you can specify this as the minimum version in your manifest, or check for GL ES 1.1 support at runtime).

Code:
// assuming somewhere along the lines there's a "GL11 gl" line or parameter
float[] output = new float[16];
gl.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, output, 0);
 
I was using GL10, but I now changed it to GL11 and called glGetFloatv(). but the array it returns only consists of zeros :(
 
I was using GL10, but I now changed it to GL11 and called glGetFloatv(). but the array it returns only consists of zeros :(

Do you have anything that is written to the ModelView Matrix? Without seeing code, it is going to be impossible to accurately troubleshoot your problem.

The method that was posted above is correct. If it is returning 0's, then the MV matrix, at the point that the above code is executed, is empty.
 
Back
Top Bottom