This project is read-only.

xen how to achieve anti-aliasing?

May 9, 2009 at 9:49 AM

Can not find RenderState.MultiSampleAntiAlias。

I use  drawToScreen.MultiSampleType get value ->none

May 9, 2009 at 11:36 AM

A render target (such as the screen backbuffer or a render texture) must be created with multisampling.

So, for example, DrawTargetTexture2D can be created with a multisampling level.
However, this cannot be done with a DrawTargetScreen, because XNA creates the backbuffer for you.

To setup multisampling for the screen, you need to specify you want multisampling in the 'SetupGraphicsDeviceManager' in your game class (this method is used in the tutorials to set the resolution).
The property you want to set is:

graphics.PreferMultiSampling = true;

 

The RenderState.MultiSampleAntiAlias value in XNA is quite different. This flag allows you to disable multisampling at run time at the draw-call level. It does not change how resources are allocated.
For example, with 4x multisampling, every pixel on the screen has 4 sub-samples, which will be averaged before being displayed on the screen. If a triangle is drawn (for example) it may draw into 3 of the 4 samples. When RenderState.MultiSampleAntiAlias is false, this will force all 4 values to always be written, which effectively disables multisampling. It's a rare thing to use, however note that most 2D elements enable this state.

May 11, 2009 at 3:13 AM

hi. StatusUnknown!

Thank you very much for the detailed reply!