In my opinion, rendering to a texture is not much different from rendering to a window. If you must make a difference, the rendering target is different. The latter is a window, and the former is a texture.
The trilogy about rendering to textures is excerpted from a user's blog below:
1. Specify the tu_rendertarget parameter to create the rendering target texture. During the creation of the rendering target texture, ogre automatically calls root: getsingleton (). getrendersystem ()-> attachrendertarget adds this texture to the root rendering target, that is, each frame is rendered to this texture.
Textureptr texture = texturemanager: getsingleton (). createmanual ("rtttex ",
Resourcegroupmanager: default_resource_group_name, tex_type_2d,
512,512, 0, pf_r8g8b8, tu_rendertarget );
2. Get the rendering target. Only when the rendering target is available can the target be specified with the view and camera.
Rendertarget * rtttex = texture-> getbuffer ()-> getrendertarget ();
3. Specify the camera for the rendering target. After this step, the camera will be rendered to texture when each frame is updated.
Viewport * V = rtttex-> addviewport (mreflectcam );