3D compass is a sample Android application showing how to use a SurfaceView 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, including the following utility classes: * CameraUseful: some routines for managing the camera and decoding image data * EGLUseful: management of EGL context and doing offscreen OpenGL rendering using pbuffers * 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. Also I put in a fixed 90° rotation compensation for the camera image in portrait mode; there are calls at Android API level 9 to calculate this more generally, which I have avoided using here. Contents: src/ -- Java 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 <ldo@geek-central.gen.nz>
an83/3D-Compass
Demo app for Android showing compass using OpenGL composited with camera preview
JavaApache-2.0