Tuesday, February 12, 2008

XNA and NVidia PerfHUD 5.2

To get NVidia's PerfHUD to work with XNA you will need to create the event in your game constructor:

this.graphics.PreparingDeviceSettings += new EventHandler(graphics_PreparingDeviceSettings);


and add the following:

void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
{
foreach (GraphicsAdapter curAdapter in GraphicsAdapter.Adapters)
{
if (curAdapter.Description.Contains("NVIDIA PerfHUD"))
{
e.GraphicsDeviceInformation.Adapter = curAdapter;
e.GraphicsDeviceInformation.DeviceType = DeviceType.Reference;
break;
}
}
}


Then build the game, and drag and drop the exe onto the NVIDIA PerfHUD 5 Launcher icon.

To see more about what NVidia PerfHud is all about watch this video:

No comments: