Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Demo app for Android showing compass using OpenGL composited with camera preview

branch: master

fix NDK warning

latest commit e9a98979e5
Lawrence D'Oliveiro authored December 16, 2013
Octocat-spinner-32 jni fix NDK warning December 16, 2013
Octocat-spinner-32 res use preferred name in API 8 and later July 14, 2013
Octocat-spinner-32 src bug in translation December 14, 2013
Octocat-spinner-32 .gitignore Major rework: March 30, 2013
Octocat-spinner-32 AndroidManifest.xml Major rework: March 30, 2013
Octocat-spinner-32 INSTALL correct explanation June 19, 2013
Octocat-spinner-32 LICENSE add readme, instructions & licence August 19, 2011
Octocat-spinner-32 README Major rework: March 30, 2013
Octocat-spinner-32 build.xml fix some compiler warnings August 05, 2013
Octocat-spinner-32 remove obsolete comments October 17, 2013
3D compass is a sample Android application showing how to display a
dynamically-updated 3D arrow with OpenGL that takes its direction from
the orientation sensor, composited on top of a live camera preview
image. The source code includes the following
utility classes:
  * CameraUseful: some routines for managing the camera and decoding
    image data
  * GeomBuilder: basic management of 3D object geometry and rendering
  * Lathe: uses GeomBuilder to construct objects with rotational symmetry
  * Compass: how to use the orientation sensor data to draw a 3D
    compass arrow

Note that the compass direction is sometimes inaccurate--at least, on
my HTC Desire it is. However, turning the phone this way and that will
often nudge it back into a sensible reading.

    src/ -- Java sources for the Android app
    jni/ -- C sources for the Android app
    res/ -- resources for the Android app
    AndroidManifest.xml, build.xml, *.properties -- for driving
        Google's Android build tools (note that you will have to
        provide a couple more of these--see INSTALL for details)
    README -- this file
    INSTALL -- build/installation instructions
    LICENSE -- licence (Apache 2.0, same as Google's sample code)

Lawrence D'Oliveiro <>
Something went wrong with that request. Please try again.