Controlling the player when opening a device from file
In this recipe we want to introduce you to a new class, OpenNI::PlaybackControl
. Using this class, you can seek a frame as well as repeat and change the speed of playback easily.
Getting ready
Create a project in Visual Studio 2010 and prepare it for working with OpenNI using the Creating a project in Visual Studio 2010 recipe of Chapter 2, Open NI and C++. After that, configure Visual Studio 2010 to use OpenGL using the Configuring Visual Studio 2010 to use OpenGL recipe of this chapter.
How to do it...
Add the following lines above your source code (just below the
#include
lines):int window_w = 640; int window_h = 480; OniRGB888Pixel* gl_texture; VideoStream depthSensor; Device device; PlaybackControl* playControl; char ReadLastCharOfLine() { int newChar = 0; int lastChar; fflush(stdout); do { lastChar = newChar; newChar = getchar(); } while ((newChar != '\n') && (newChar != EOF)); return (char)lastChar...