Documentation
¶
Overview ¶
Example: obtain the Android Choreographer singleton.
AChoreographer is the central timing coordinator for frame production on Android. The display subsystem raises a vsync interrupt at the panel's refresh rate (typically 60, 90, or 120 Hz). AChoreographer exposes that signal to user-space so that game loops and rendering engines can start each frame's work at the optimal moment, avoiding jank caused by submitting frames out of phase with the display.
A typical usage pattern in a game engine:
- Obtain the singleton with GetInstance (one per Looper thread).
- Register a frame callback via postFrameCallback.
- Inside the callback, compute the delta from the previous vsync timestamp, advance simulation, record draw commands, and re-register the callback for the next frame.
Because the choreographer is a process-wide singleton tied to the calling thread's Looper, it does not require explicit cleanup -- there is no Close method.
This program must run on an Android device with NDK choreographer support.