# ID3DXSprite Scaling Filter

This topic is 3513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm wondering if there is a way to set what type of filtering is done when ID3DXSprite scales a sprite. I'd rather it used nearest neighbor, instead of what it does by default (I'm guessing bilinear or something), because of the old-school look I'm trying to achieve. Does anyone know if this can be done? Or is this done with the device interface? Thanks!

##### Share on other sites
You can't do it through the sprite interface, you have to do it by directly setting the sampler state for the device. If you look at the documentation for ID3DXSprite::Begin, you'll notice that it lists a whole bunch of device states that are set when you call this method. Towards the bottom you'll see the two you're interested in: D3DSAMP_MINFILTER and D3DSAMP_MAGFILTER.

Anyway what you need to do is set those sampler states to the value you want after you've called Begin. Which is a piece of cake:
pSpriteInterface->Begin(D3DXSPRITE_ALPHABLEND);pDevice->SetSamplerState(D3DSAMP_MINFILTER, D3DTEXF_POINT);pDevice->SetSamplerState(D3DSAMP_MAGFILTER, D3DTEXF_POINT);// Draw your sprites

1. 1
2. 2
3. 3
4. 4
Rutin
17
5. 5

• 11
• 20
• 12
• 11
• 41
• ### Forum Statistics

• Total Topics
631402
• Total Posts
2999870
×