
CHAPTER 3 ■ WORKING WITH 2D IMAGES/TEXTURES IN XNA 3.0
213
In the Draw method, you activate your custom render target, clear it, render into it,
deactivate it, and save its contents into a texture. Important to note is that you use your
rendertargetProjectionMatrix to render 3D objects into your custom render target (shown in
the following code). Optionally, this texture is displayed on the screen using a SpriteBatch:
protected override void Draw(GameTime gameTime)
{
device.SetRenderTarget(0, renderTarget);
device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer,
➥
Color.CornflowerBlue, 1, 0);
cCross.Draw(fpsCam.ViewMatrix, rendertargetProjectionMatrix); ...