Using a green screen with Kinect
Now we can develop a simple game to satisfy ourselves, which will also be used as part of our Fruit Ninja game. The idea can be described as a magic photographer who automatically puts the photo of the player in front of the Kinect device onto any scenery images, pretending that he had taken this photo some time ago.
The example we just finished is used to show a player with a single colored background, so the only work left is to load a still image from the disk and blend it with the player image to produce a final composite photo.
Making a magic photographer
Let's continue working on the previous example code we created, which already contains the kernel functionality for our use:
We need a background image to be shown under the player's image. The alpha channel of the player texture will be used to decide if the background should show or not. FreeImage is used to load the image from a disk file and bind it to an OpenGL texture. The global ID for the texture...