One common use of render to texture is for creating flat-mirrored surfaces in 3D applications. In this recipe, we'll show you how to create a mirror, by extending on the techniques presented in the Render to texture recipe.
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
Mirror
, by following the Creating an MFC Ogre application recipe from Chapter 1.2. Create a class called
MirrorListener
that derives fromOgre::RenderTargetListener
. We will use this listener class to hide the mirror entity when the Render To Texture (RTT) camera renders the scene, and then unhide the mirror when the main camera renders the scene.class MirrorListener : public Ogre::RenderTargetListener { public: MirrorListener():Ogre::RenderTargetListener() { m_PlaneEntity = NULL; } void preRenderTargetUpdate(const Ogre...