1
0
Fork 0
mirror of https://github.com/vanitasvitae/Spherical synced 2024-11-22 12:22:08 +01:00

Fix camera rotation

This commit is contained in:
Paul Schaub 2018-02-20 15:05:33 +01:00
parent 92c84e8281
commit 42c11c185d
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -65,7 +65,7 @@ public class PhotoSphereRenderer implements GLSurfaceView.Renderer {
private float modelMatrix[] = new float [16];
// Store view matrix.
private float viewMatrix [] = new float [16];
// private float viewMatrix [] = new float [16];
// Store the model view projection matrix.
private float mvpMatrix [] = new float [32];
@ -115,9 +115,9 @@ public class PhotoSphereRenderer implements GLSurfaceView.Renderer {
uploadImage();
// Update transformation matrix.
//Matrix.multiplyMM(mvpMatrix, 0, surfaceView.getRotationMatrix(), 0, modelMatrix, 0);
//Matrix.multiplyMM(mvpMatrix, 16, viewMatrix, 0, mvpMatrix, 0);
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, surfaceView.getRotationMatrix(), 0);
Matrix.multiplyMM(mvpMatrix, 16, surfaceView.getRotationMatrix(), 0, modelMatrix, 0);
//Matrix.multiplyMM(mvpMatrix, 0, viewMatrix, 0, mvpMatrix, 0);
Matrix.multiplyMM(mvpMatrix, 0, projectionMatrix, 0, mvpMatrix, 16);
// Draw the frame.
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -181,8 +181,8 @@ public class PhotoSphereRenderer implements GLSurfaceView.Renderer {
glGenTextures(1, textureID, 0);
// Initialize matrices.
//Matrix.setRotateM(modelMatrix, 0, 90, 1.0f, 0.0f, 0.0f);
Matrix.setLookAtM(viewMatrix, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f);
Matrix.setRotateM(modelMatrix, 0, 90, 1.0f, 0.0f, 0.0f);
//Matrix.setLookAtM(viewMatrix, 0, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f);
}
/**