In the preceding recipes, we use a
while loop to read frames of data from
nite::HandTracker. This is not a good idea since this will block our application and even the
while loop itself until new data becomes available. Fortunately, NiTE has given us this ability to introduce a class/struct with a method in it to be called when a new frame of data becomes available. So our application can do what we want it to do and, when new data becomes available, we can read it without busying our main application thread. In this recipe, we will show you how to use this feature.
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++.