Possible en double:
Is Google’s Android OpenGL tutorial teaching incorrect linear algebra?Ne tourne pas après l'application de la matrice de transformation
Learning OpenGL ES 2.0 sur Android. Utilisation d'Emulator, sous Android 4.1.
extraits et collés de Copié Android Developer Site/OpenGL
Mise à jour méthode . Collé ci-dessous. Ajouté Matrix.setIdentityM(mRotationMatrix, 0)
car il s'agit d'un Null Matrix. Modification de l'angle d'angle (ligne 16).
public void onDrawFrame(GL10 unused) {
// Redraw background color
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
// Set the camera position (View matrix)
Matrix.setLookAtM(mVMatrix, 0, 0, 0, -3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
// Calculate the projection and view transformation
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);
// Create a rotation transformation for the triangle
long time = SystemClock.uptimeMillis() % 4000L;
float angle = 0.090f * ((int) time);
Matrix.setIdentityM(mRotationMatrix, 0); //added
Matrix.setRotateM(mRotationMatrix, 0, angle, 0, 0, 1.0f); //changed
// Combine the rotation matrix with the projection and camera view
Matrix.multiplyMM(mMVPMatrix, 0, mRotationMatrix, 0, mMVPMatrix, 0);
// Draw shape
mTriangle.draw(mMVPMatrix);
}
Et ont commenté sur setRenderMode(RENDERMODE_WHEN_DIRTY);
Pourtant, le triangle tracé n'a pas tourné. Où est-ce que je me suis trompé?
S'il vous plaît voir le code exemple de la réponse de Ian à [cette question] (http://stackoverflow.com/questions/11925647/is-googles-android-opengl-tutorial-teaching-incorrect-linear-algebra) . Le tutoriel google OpenGL est cassé et déroutant. – Tim
Merci, ça marche maintenant. –