OpenGL ES Android Transformations de Matrice

J'ai un convertisseur de mise en œuvre de GLSurfaceView.Convertisseur d'interface; une sous-classe de GLSurfaceView et certaines classes représentant mes objets, je tiens à attirer. J'ai le code de http://developer.android.com/training/graphics/opengl/motion.html
Je veux élargir cette et ajouter un peu de mouvement le long des axes et ne pouvez pas le gérer. L'objet n'est que de la rotation.
et voici mon code:

public class NotMyCoolRenderer implements GLSurfaceView.Renderer {
public GLShip mTriangle;
private GLBackgroundStar   mSquare;
private final float[] mMVPMatrix = new float[16];
private final float[] mProjMatrix = new float[16];
private final float[] mVMatrix = new float[16];
private final float[] mModelMatrix = new float[16];
private final float[] tempMatrix = new float[16];
public void onDrawFrame(GL10 unused) {
//Draw 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);
//Draw square
mSquare.draw(mMVPMatrix);
//Now moving on to triangle aka ship
Matrix.setIdentityM(mModelMatrix, 0);
Matrix.translateM(mModelMatrix, 0, 0.1f, 0f, 0);
Matrix.rotateM(mModelMatrix, 0, mTriangle.mAngle, 0, 0, -1.0f);
Matrix.multiplyMM(tempMatrix, 0, mVMatrix, 0, mProjMatrix, 0); 
Matrix.multiplyMM(mMVPMatrix, 0, mModelMatrix , 0, tempMatrix , 0);  
//Draw triangle
mTriangle.draw(mMVPMatrix);
}
public void onSurfaceChanged(GL10 unused, int width, int height) {
//Adjust the viewport based on geometry changes,
//such as screen rotation
GLES20.glViewport(0, 0, width, height);
float ratio = (float) width / height;
//this projection matrix is applied to object coordinates
//in the onDrawFrame() method
Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
}
public class GLShip {
public volatile float mAngle;
private final String vertexShaderCode =
//This matrix member variable provides a hook to manipulate
//the coordinates of the objects that use this vertex shader
"uniform mat4 uMVPMatrix;" +
"attribute vec4 vPosition;" +
"void main() {" +
//the matrix must be included as a modifier of gl_Position
"  gl_Position = uMVPMatrix * vPosition;" +
"}";
public void draw(float[] mvpMatrix) {
//Add program to OpenGL environment
GLES20.glUseProgram(mProgram);
//get handle to vertex shader's vPosition member
mPositionHandle = GLES20.glGetAttribLocation(mProgram, "vPosition");
//Enable a handle to the triangle vertices
GLES20.glEnableVertexAttribArray(mPositionHandle);
//Prepare the triangle coordinate data
GLES20.glVertexAttribPointer(mPositionHandle, COORDS_PER_VERTEX,
GLES20.GL_FLOAT, false,
vertexStride, vertexBuffer);
//get handle to fragment shader's vColor member
mColorHandle = GLES20.glGetUniformLocation(mProgram, "vColor");
//Set color for drawing the triangle
GLES20.glUniform4fv(mColorHandle, 1, color, 0);
//get handle to shape's transformation matrix
mMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
NotMyCoolRenderer.checkGlError("glGetUniformLocation");
//Apply the projection and view transformation
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix, 0);
NotMyCoolRenderer.checkGlError("glUniformMatrix4fv");
//Draw the triangle
GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, vertexCount);
//Disable vertex array
GLES20.glDisableVertexAttribArray(mPositionHandle);
}
}

Mes attentes sont que sur chaque redessiner l'objet est mis en rotation par la mutilation et traslated le long de l'Axe Y par 1f. Je ne peux voir qu'en rotation (un peu projeté trop) bien.
J'ai effectivement eu quelques questions concernant:
comment puis-je demander ma traduction de la matrice et
quelle est la meilleure pratique de la division de la fonctionnalité opengl? Ne faudrait-il pas modelMatrix être stockés dans l'objet lui-même plutôt que dans le moteur de rendu? Si la matrice opérations exécutées dans le moteur de rendu de classe?
J'ai regroupés comme je suppose qu'ils sont tous liés.

Hmm. toujours rien à expliquer comment mProjMatrix est initialisé.
Voici un dernier conseil: essayez de reproduire étape par étape les leçons de learningwebgl.com/blog/?page_id=1217 . Elle ne couvre que le javascript, mais les différences sont à côté des minimes. L'API est la même et la matrice de calcul est le même. Bonne chance!
Dans un autre thread les gens suggéré (pour le même code de la même tutoriel) à l'aide de gl_Position = uMVPMatrix * vPosition; au lieu de gl_Position = vPosition * uMVPMatrix;. Si j'ai suivi la suggestion, je ne peux pas voir mon triangle à tous
Vous devez également calculer le MVP de la matrice dans l'ordre de M,V,P. Vous devez calculer actuellement dans l'ordre de P,V,M
cela ne résout absolument pas le problème. Je ne peux pas voir mon triangle avec M*V*P) à tous

OriginalL'auteur Michael T | 2012-11-20