Filtering is the process of modifying how a texture is drawn to reduce the effect of pixellation when viewing a texture at a large size on screen. For a more in-depth (conceptual) discussion about filtering, see the Filtering page.

The default value is Linear.

The GraphicsOptions.TextureFilter property can be used to control the default project-wide texture filter. Individual Sprites can overwrite this value. For more information, see the Sprite TextureFilter page.

Code Example

Filtering can be controlled through the GraphicsOptions class. The following code creates a large Sprite which takes up the entire screen. Pressing the space key toggles the filtering between Linear (on) and Point (off).

Add the following using statement:

Add the following in Initialize after initializing FlatRedBall:

Add the following to Update:


TextureFilter.Point and Tile Maps

If you are using tile maps (such as loading a .tmx file) then you will most likely need to set the texture filter to point. Otherwise you may see lines between your tiles:

Additional Information

The TextureFilter enumeration is an XNA enumeration. More information on the enumeration can be found here.

More information on Filtering can be found in the filtering wiki entry.