In this recipe, we are going to show you how to use
nite::UserMap to get the user ID for each pixel in the depth stream. By using this information, we can change the color of pixels belonging to one user.
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++. Then configure Visual Studio to use OpenGL using the Configuring Visual Studio 2010 to use OpenGL recipe in Chapter 4, More about Low Level Outputs.
Add these lines to the top of your source code (just below
#includelines). Here we have defined variables to be used with OpenGL along with a
nite::UserTrackervariable that is going to hold a list of users and any other information about users in all the functions.
int window_w = 640; int window_h = 480; OniRGB888Pixel* gl_texture; nite::UserTracker uTracker;