Creating Render Targets and Surfaces

Now that you have a track and multiple karts being rendered, you can get your scene ready to create a rear-view mirror effect. To do this task, you need to create a texture that is a render target. As the name implies, a render target is the target of your rendering. Before you begin with that, though, you need to ensure that your device is capable of rendering to a render target of the appropriate type. Find the IsDeviceAcceptable method and before the final return true; line, add the following:

 // Skip back buffer formats that don't support render targets format we want if (!Manager.CheckDeviceFormat(caps.AdapterOrdinal, caps.DeviceType, adapterFormat, Usage.RenderTarget, ResourceType.Textures, Format.X8R8G8B8)) ...

Get Beginning 3D Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.