android gl11,opengl es - Problem with getFloatv function in GL11 (Android) - Stack Overflow

I'm learning Open GL ES and would like to get a more intuitive interface with 3D objects than the one suggested by google in the TouchRotateActivity sample.

In order to do that, I would like to multiply my Modelview matrix by the ModelView matrix in the previous state.

But I encounter the following problem : getFloatv function returns 0 values in my float array, and I don't understand why (my ModelView matrix is not empty : if it was, I wouldn't get my cube on the screen).

Could someone help me to figure out what the problem is? Here are the changes in the code .

private float[] previous;

public CubeRenderer() {

mCube = new Cube();

previous = new float[16];

}

public void onDrawFrame(GL10 gl) {

GL11 gl11 = (GL11) gl;

gl11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

gl11.glMatrixMode(GL11.GL_MODELVIEW);

gl11.glLoadIdentity();

gl11.glTranslatef(0, 0, -3.0f);

gl11.glRotatef(mAngleX, 0, 1, 0);

gl11.glRotatef(mAngleY, 1, 0, 0);

gl11.glEnableClientState(GL11.GL_VERTEX_ARRAY);

gl11.glEnableClientState(GL11.GL_COLOR_ARRAY);

/*if(!previous.equals(new float[16]))

gl11.glMultMatrixf(previous, 0);*/

gl11.glGetFloatv(GL11.GL_MODELVIEW_MATRIX, previous, 0);

Log.d("taille matrice",Integer.toString(previous.length));

for(int i=0; i

Log.d(Integer.toString(i),Float.toString(previous[i]));

mCube.draw(gl11);

}

Thank you in advance.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值