Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a simple game for Android. To start, I am trying to make the square move down the y-axis, but the way I am doing it, it doesn't move the square at all and I can't find any tutorials for GLES20.

The onDrawFrame function in the render class updates the user's position based on acceleration due to gravity, gets the transform matrix from the user class which is used to move the square down, then the program draws it.

All that happens is that the square is drawn; no motion happens:

public void onDrawFrame(GL10 gl) 
    user.update(0.0, phy.AccelerationDewToGravity);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Re draws black background

    GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 12, user.SquareVB);//triangleVB);
    GLES20.glUniformMatrix4fv(maPositionHandle, 1, false, user.getTransformMatrix(), 0);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);


The update function in the player class is

public void update(double vh, double vv)
    Vh += vh; // Increase horrzontal Velosity
    Vv += vv; // Increase vertical velosity

    //Matrix.translateM(mMMatrix, 0, (int)Vh, (int)Vv, 0);
    Matrix.translateM(mMMatrix, 0, mMMatrix, 0, (float)Vh, (float)Vv, 0);
share|improve this question
Its been too long since ive done anything with OpenGL ES so I cant offer a good solution, but here is a link to a site that gives decent tutorials – Mungoid Jun 18 '12 at 14:02
I don't see any interaction between GLES20 and you mMMatrix object. – VinceFR Jun 20 '12 at 13:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.