Initializing and preparing OpenGL
If we want to use OpenGL for showing frames and other data to the user, we must know how to implement OpenGL's main functionalities in our project. This recipe is about how to initialize and prepare OpenGL to be used in other recipes.
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++. Then, configure Visual Studio 2010 to use OpenGL using the Configuring Visual Studio 2010 to use OpenGL recipe of this chapter.
How to do it...
Open your project and then your project's main source code file.
Add the following lines above your source code (just below the
#include
lines):int window_w = 640; int window_h = 480; OniRGB888Pixel* gl_texture; void gl_KeyboardCallback(unsigned char key, int x, int y) { if (key == 27) // ESC Key exit(1); } void gl_IdleCallback() { glutPostRedisplay(); } void gl_DisplayCallback() { // Clear the OpenGL...