getting model view matrix in Android?

↘锁芯ラ 提交于 2019-12-24 07:06:18

问题


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_matrix);

回答1:


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.




回答2:


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);


来源:https://stackoverflow.com/questions/7106824/getting-model-view-matrix-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!