I was under the impression that gl.glTranslatef() effectively moved a sprite by the values passed in to the method (ie if I wanted a sprite to move by 2 pixels I would call gl.glTranslate(2.0f,0.0f,0.0f);
However If I do this then the sprite remains static. However If I pass in an absolute position (ie call gl.glTranslatef(52.0f,0.0f,0.0f)) my sprite moves as expected. However its starting position is out by the initial position coordinates (ie If I specify the sprite to start at 30,30 then the first draw loop draws the sprite at 62,30, once the first frame is done the sprite moves as I expect.
What is going on?
here is the draw code for my sprite.
//Reset the modelview matrix
gl.glLoadIdentity();
//drawing
//bind the previously generated texture
gl.glBindTexture(GL10.GL_TEXTURE_2D,this._texture);
//point to our buffers
gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
//set the face rotation
gl.glFrontFace(GL10.GL_CW);
gl.glPushMatrix();
gl.glTranslatef(_position.x,_position.y,0.0f);//need to work out fraction of 1 that the position of the sprite represents
//point to our vertex buffer
gl.glVertexPointer(3, GL10.GL_FLOAT, 0, _vertexBuffer);
gl.glTexCoordPointer(2, GL10.GL_FLOAT, 0, _textureBuffer);
//draw the vertices as a triangle strip
gl.glDrawArrays(GL10.GL_TRIANGLE_STRIP, 0, _vertices.length / 3);
//gl.glPopMatrix();
//disable the client state before leaving
gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
Note that this passes in the absolute position and not the small extra movement.