Displaying the Rear-View Mirror


Now that you have the scene rendered into your texture, it should be a simple matter to get that displayed onscreen. Because it is a single texture, you can re-use the sprite class you used for the background of the user screen to render the rear-view mirror. In the OnFrameRender method, find the call to RenderScene and add this code snippet, which should show you a scene similar to Figure 22.3:

 // Render the rear-view mirror texture backgroundSprite.Begin(SpriteFlags.None); backgroundSprite.Draw2D(rearTexture, System.Drawing.Rectangle.Empty,     new System.Drawing.Rectangle(0,0,256,128), new System.Drawing.Point(200, 0),     unchecked((int)0xffffffff)); backgroundSprite.End(); 

Figure 22.3. A rear-view mirror.




Beginning 3D Game Programming
Beginning 3D Game Programming
ISBN: 0672326612
EAN: 2147483647
Year: 2003
Pages: 191
Authors: Tom Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net