How to use onSensorChanged sensor data in combination with OpenGL

I couldn't test the code yet (but I will, looks really interesting). One thing that caught my attention is that you don't seem to filter the sensor data in any way.

Sensor readings are very noisy by nature, specially the magnetic sensor. I'd suggest you implement some low pass filtering.

See my previous answer for further reading.


It would be easier to test and debug Method 5 using GLU's lookAt function: http://www.opengl.org/sdk/docs/man2/xhtml/gluLookAt.xml

Also, as villoren suggested it's good to filter your sensor data, but it wouldn't really cause bugs if you move de device slowly. If you want to try, a simple one would be as follows:

newValue = oldValue * 0.9 + sensorValue * 0.1;
oldValue = newValue;