Let's use multisample anti-aliasing(MSAA).
The code hooked in a PreparingDeviceSetting event is added to the constructor of a Game1 class.
graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(GraphicsPreparingDeviceSettings);And the following codes are added.
void GraphicsPreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) { PresentationParameters pp = e.GraphicsDeviceInformation.PresentationParameters; #if XBOX pp.MultiSampleQuality = 1; pp.MultiSampleType = MultiSampleType.FourSamples; return; #endif GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter; SurfaceFormat format = adapter.CurrentDisplayMode.Format; int quality = 0; if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, MultiSampleType.FourSamples, out quality)) { pp.MultiSampleQuality = 0; pp.MultiSampleType = MultiSampleType.FourSamples; } else if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format, false, MultiSampleType.TwoSamples, out quality)) { pp.MultiSampleQuality = 0; pp.MultiSampleType = MultiSampleType.TwoSamples; } }Reference
Higeneko diary