开发者

getting model view matrix in Android?

开发者 https://www.devze.com 2023-03-29 03:51 出处:网络
how to get current model view matrix in Android?i am using OpenGL 1.1,the method GL.getFloatv() is giving zero values.please help.

how to get current model view matrix in Android?i am using OpenGL 1.1,the method GL.getFloatv() is giving zero values.please help.

float[] model_matrix = new float[16];
GL11.getFloatv(GL11.GL_MODELVIEW_MATRIX,model_matri开发者_StackOverflowx);


Just a guess, since you don't show any code: you should be using GL11.GL_MODELVIEW_MATRIX, and not GL_MODELVIEW for requesting the matrix values.


Not sure if this is still pending or which version you used, but as of now, the GLES11.glGetFloatv has 2 overloads and the the one using float[16] requires 3 parameters. The one with 2 params takes a FloatBuffer. This works for me:

float[] model_matrix = new float[16];
GLES11.glGetFloatv(GLES11.GL_MODELVIEW_MATRIX, model_matrix, 0);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号