I am having an issue where I am trying to get touch input and move the camera along the x and y axis. What I assume would happen is that I would swipe a finger across the scene and the scene would move along in the motion of my finger.
https://i.stack.imgur.com/LVoYv.jpg //Images of the scene
This is how it starts, I'd like to be able to move my finger from the top to the bottom and have the multicolored squares move down. Unfortunately it gets skewed and I can't seem to figure out why.
Here is the code I'm using to set up the camera.
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, m_pos_x, m_pos_y, -100, m_pos_x, m_pos_y, 0, 0.0f, 1.0f, 0.0f);
PrintMatrix(mVMatrix);
Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mVMatrix, 0);
// Draw triangle
mTriangle.draw(mMVPMatrix);
//Draw the square grids
for(int i = 0; i < row_size; i++)
{
for(int j = 0; j < row_size; j++)
{
// Draw square
mSquare[i*row_size + j].draw(mMVPMatrix);
}
}
}
m_pos_x and m_pos_y are both being set in another class and is based off of the difference in touch input from frame to frame.
Any ideas what I am doing wrong?