実際、これをレンダラークラスのdrawメソッドに組み込んでいます。
Matrix.setIdentityM(mMMatrix, 0);
// Rotate view
long time = SystemClock.uptimeMillis()*4000L;
float angle = .09F*(int)time;
Matrix.setRotateM(mMMatrix, 0, angle, 1, 0, 0);
Matrix.rotateM(mMMatrix, 0, -2f, 1, 0, 0);
//Matrix.scaleM(mMMatrix, 0, 0.01f, 0.01f, 0.01f);
// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mVMatrix, 0, mMMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVPMatrix, 0);
// Draw Shapes
obj.draw(mMVPMatrix);
しかし、それは機能しません...私は他のいくつかを試しましたが、運がありませんでした。オブジェクトは同じままで、回転しません。
更新:コードをこれに変更しましたが、運がありません。
// Clear Screen
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT);
Matrix.setIdentityM(mMMatrix, 0);
// Rotate view
Matrix.setRotateM(mMMatrix, 0, angle, 1, 0, 0);
//Matrix.scaleM(mMMatrix, 0, 0.01f, 0.01f, 0.01f);
// Calculate the projection and view transformation
Matrix.multiplyMM(mMVMatrix, 0, mVMatrix, 0, mMMatrix, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVMatrix, 0);
// Draw Shapes
obj.draw(mMVPMatrix);