Tracking hands
In this recipe, we are going to expand on the previous recipe and add hand tracking after recognizing a gesture. Moreover, we will also show the location of a hand in the screen overlying the depth frame data.
Getting ready
Create a project in Visual Studio and prepare it for working with OpenNI and NiTE using the Create a project in Visual Studio 2010 recipe in Chapter 2, OpenNI and C++, and then configure Visual Studio to use OpenGL using the Configuring Visual Studio 2010 to use OpenGL recipe in Chapter 3, Using Low-level Data.
How to do it...
Define the
window_w
,window_h
, andgl_texture
variables on top of your source code, below the#include
lines, just as with the other examples we wrote using OpenGL and GLUT.Add the following code right below them:
nite::HandTracker hTracker;
Copy
ReadLastCharOfLine()
andHandleStatus()
from the first recipe of this chapter and paste it here. Also, copygl_IdleCallback()
from the Initialize and prepare OpenGL recipe in Chapter 3, Using Low...