Before I begin this post, big thanks to Eibx and David over at the Community Forums for helping me find these methods. I have modified the CheckTexture method a bit, but its purpose remains unchanged.
As of the last FGF article, the Application class was implementing the IGame interface but was missing the ability to create a render target object on the PC and Xbox 360. For PC games this can be a troubling problem since different hardware can obviously require different formats and dimensions of render target. Rather than bake this functionality into the Application class itself, it is moved to a static helper class so that all developers can make good use of its functionality at any point in time.
To start off, a simple default creation method is included to give the basic functionality an easy access point.
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace FocusedGames.Xna.Graphics
{
public static class GraphicsHelper
{
public static RenderTarget2D CreateRenderTarget(GraphicsDevice device)
{
return CreateRenderTarget(
device,
device.PresentationParameters.BackBufferWidth,
device.PresentationParameters.BackBufferHeight,
1,
device.PresentationParameters.BackBufferFormat
);
}
