In this recipe, we'll introduce Ogre's method of rendering to a texture, by showing you how to render the contents of a camera viewport onto a texture in a 3D scene. This technique is the basis for many useful effects, including shadow maps, GPU-based calculations, deferred rendering, and so on.
To follow this recipe, open the solution located in the Recipes/Chapter08
folder in the code bundle available on the Packt website.
1. First, create a new Ogre MFC application named
RTT
, by following the Creating an MFC Ogre application recipe from Chapter 1, Delving Deep into Application Design2. In
CMirrorView::EngineSetup()
, add a robot to the scene to give us something to reflect.Ogre::Entity *RobotEntity = m_SceneManager-> createEntity("Robot", "robot.mesh"); Ogre::SceneNode *RobotNode = m_SceneManager-> getRootSceneNode()->createChildSceneNode(); RobotNode->attachObject(RobotEntity);
3. Next, create a second camera named
RTTCam...