我的翻译和轮换存在问题。 当我想像这样旋转它的工作 http://i.stack.imgur.com/UyeOn.png
textureProgram.useProgram();
for ( i =0; i < 5; i ++)
{
Matrix.setLookAtM(modelMatrix, 0, 0, 0, 1.0f, 0.0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.multiplyMM(modelViewProjectionMatrix, 0, projectionMatrix, 0, modelMatrix, 0);
Matrix.setRotateM(RotationMatrix, 0, 12f, 0, 0, 1.0f);
Matrix.multiplyMM( projectionMatrix, 0, modelViewProjectionMatrix, 0, RotationMatrix, 0);
textureProgram.setUniforms(projectionMatrix, mur1texture);
this.bindData(textureProgram);
glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
}
但我不能在我的OrthoM投影中旋转超过我的远数,我根本不明白。 例如,如果我的号码是3,就像这样:
Matrix.orthoM(projectionMatrix, 0, 0, 1280, 800, 0, -1, 3);
即使我必须旋转5次,我也能旋转3次而不是更多次。 例如,我必须增加数量才能旋转5次。 有人可以帮助我,我真的不明白这个问题。
编辑:这样,它只旋转一次,旋转时物体会变形。
http://i.stack.imgur.com/jEfID.png
for ( i =0; i < 5; i ++)
{
Matrix.setLookAtM(modelMatrix, 0, 0, 0, 1.0f, 0.0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.setRotateM(RotationMatrix, 0, 12f, 0, 0, 1.0f);
Matrix.multiplyMM(modelMatrix, 0, modelMatrix, 0, RotationMatrix, 0);
Matrix.multiplyMM(modelViewProjectionMatrix, 0, projectionMatrix, 0, modelMatrix, 0);
textureProgram.setUniforms(modelViewProjectionMatrix, mur1texture);
this.bindData(textureProgram);
glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
}
编辑2: 这样它可以正常旋转但只旋转一次:S。
for ( i =0; i < 5; i ++)
{
Matrix.setLookAtM(modelMatrix, 0, 0, 0, 1.0f, 0.0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.multiplyMM(modelViewProjectionMatrix, 0, projectionMatrix, 0, modelMatrix, 0);
Matrix.setRotateM(RotationMatrix, 0, 45f, 0, 0, 1.0f);
Matrix.multiplyMM(modelViewProjectionMatrix, 0, projectionMatrix, 0, RotationMatrix, 0);
textureProgram.setUniforms(modelViewProjectionMatrix, mur1texture);
this.bindData(textureProgram);
glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
}
编辑3:仍然只旋转一次。
int u , i ;
textureProgram.useProgram();
Matrix.setLookAtM(modelmatrix, 0, 0, 0, 1.0f, 0.0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.multiplyMM(modelViewProjectionMatrix, 0, projectionMatrix, 0, modelmatrix, 0);
for ( i =0; i < 5; i ++)
{
Matrix.setRotateM(RotationMatrix, 0, 12f, 0, 0, 1.0f);
Matrix.multiplyMM( modelViewProjectionMatrix, 0, projectionMatrix, 0,RotationMatrix, 0);
textureProgram.setUniforms(modelViewProjectionMatrix, mur1texture);
this.bindData(textureProgram);
glDrawArrays(GL_TRIANGLE_FAN, 0, 6);
}