![]() |
Leap Motion C API
4.1.0
The API to the LeapC library.
|
The 3D Drawing Example illustrates how to access the tracking data in a more "complete" application – in this a simple GLUT-based window. Because you cannot send drawing commands from a secondary thread, this example uses callbacks to set state variables that the GLUT thread then checks during its idle loop. If a new tracking frame is available, the idle() function calls a GLUT function to signal that a redraw is needed. The example then polls the ExampleConnection object to get the latest frame of data.
The hands are drawn using a GLUT primitives at the position of the elbow, the wrist, the palm point and the end of each bone in the fingers.
This example is only supported on platforms for which a working version of GLUT exists. It should not be overly difficult to port the example to a different OpenGL-based context, however.
The Leap Motion service creates the tracking data provided in a LEAP_TRACKING_EVENT struct by analyzing a set of stereo images taken by the Leap Motion device cameras. The image set used to create a frame of data can be obtained by calling LeapRequestImages(). LeapC writes the set of stereo images to a buffer that you supply; stacked with the left image on top of the right image. After you call LeapRequestImages(), LeapC dispatches a LEAP_IMAGE_COMLETE_EVENT message through the usual message pump when the image buffer has been completely written. The message struct also contains the image properties.