Rendering to Surfaces
Have you ever been playing a game, such as a racing game, and seen how you can turn on a “rear-view” mirror? Possibly you've played one of the kart racing games where there is a billboard showing the race in the background? These effects are normally achieved by rendering the same scene (most times with a different camera) into a texture. Actually, despite sounding somewhat difficult, this is in reality quite simple to do. You can once again take the example for loading a mesh from a file from Chapter 5, “Rendering with Meshes,” and update it for this example.
We will naturally need to declare a new texture that we will be rendering to, among other things, so add the following declarations:
private Texture renderTexture ...