mirror of
https://github.com/vanitasvitae/Spherical
synced 2024-12-22 02:48:00 +01:00
Fix random flickering
This commit is contained in:
parent
395c82f341
commit
a8b4e0ecb2
2 changed files with 1 additions and 6 deletions
|
@ -173,7 +173,7 @@ public class Renderer implements GLSurfaceView.Renderer {
|
|||
glGenTextures(1, textureID, 0);
|
||||
|
||||
// Initialize matrices.
|
||||
Matrix.setIdentityM(modlMatrix, 0);
|
||||
Matrix.setRotateM(modlMatrix, 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,10 @@ public class SphereSurfaceView extends GLSurfaceView implements SensorEventListe
|
|||
// The actual rotation matrix determined by user input.
|
||||
private final float rotationMatrix [] = new float[16];
|
||||
|
||||
// This matrix is used to compensate sensor coordinate system rotation.
|
||||
private final float offsetMatrix [] = new float[16];
|
||||
|
||||
public SphereSurfaceView(Context context) {
|
||||
super(context);
|
||||
|
||||
Matrix.setIdentityM(rotationMatrix, 0);
|
||||
Matrix.setRotateM(offsetMatrix, 0, 90.0f, 1.0f, 0.0f, 0.0f);
|
||||
|
||||
SensorManager manager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
|
||||
Sensor accelerometer = manager.getSensorList(Sensor.TYPE_ROTATION_VECTOR).get(0);
|
||||
|
@ -83,7 +79,6 @@ public class SphereSurfaceView extends GLSurfaceView implements SensorEventListe
|
|||
|
||||
synchronized (rotationMatrix) {
|
||||
SensorManager.getRotationMatrixFromVector(rotationMatrix, event.values);
|
||||
Matrix.multiplyMM(rotationMatrix, 0, rotationMatrix, 0, offsetMatrix, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue