Sign in to follow this  
Uphoreum

ID3DXSprite Scaling Filter

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 this post


Link to post
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




Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this