iPhone OS Reference Library Apple Developer Connection spyglass button

Version: 2.1

Posted: 2009-10-02

Build Requirements: iPhone SDK 3.1 and later

Runtime Requirements: iPhone OS 3.1 and later

View Source Code:

Download Sample Code (“GLGravity.zip”, 58.5K)



Description

The GLGravity sample application demonstrates how to use the UIAccelerometer class in combination with OpenGL rendering. It shows how to extract the gravity vector from the accelerometer values using a basic low-pass filter, and how to build an OpenGL transformation matrix from it.

Document Revision History

Date Notes
2009-10-02Updated for iPhone OS 3.1. Use CADisplayLink as the preferred method for controlling animation timing, and fall back to NSTimer when running on a pre 3.1 device where CADisplayLink is not available. Made the sample xib-based.
2008-07-03Initial public release.
Did this document help you? Yes It's good, but... Not helpful...