Android : scene camera not pointing directly at scene

on Sunday, April 19, 2015


My clipping view isn't aligned in the y-axis. Its like the camera is looking a bit lower than it should be. The x-axis is completely fine, the edge of the scene lines up with the edge of the device screen. I thought that maybe I should rotate the 'mViewMatrix' first but my attempts at that have failed. What should I be doing?



@Override
public void onSurfaceChanged(GL10 unused, int width, int height) {

GLES20.glViewport(0, 0, width, height);// Sets the current view port to the new size.

float RATIO = (float) width / (float) height;

Matrix.orthoM(mProjectionMatrix, 0, -RATIO, RATIO, -1, 1, -1, 1);

}

@Override
public void onDrawFrame(GL10 unused) {

Matrix.setLookAtM(mViewMatrix, 0, 0, 0, -1, 0f, 0f, 0f, 0f, 1.0f, 0.0f);// Set the camera position (View matrix)
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mViewMatrix, 0);// Calculate the projection and view transformation

0 comments:

Post a Comment