0
其實Im做這在我的渲染器類的繪製方法:如何在Android(Java)和OpenGL ES 2.0旋轉
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);
我會盡力感謝。 – Enriquillo 2012-08-02 20:07:34
我做了更改,並得到了相同的結果。其他一些建議? – Enriquillo 2012-08-03 14:43:23
我發現這個鏈接[http://www.programforandroid.com/android-programming-tutorials/opengl-es-2-0/]如何解釋一個垃圾更好的android開發人員示例。我和它的作品:)。我的問題是在着色器代碼形式的對象.... – Enriquillo 2012-08-04 19:44:53