Extra Border Around ID3DXSprite [SOLVED]

Started by
13 comments, last by Haytil 14 years, 1 month ago
Quote:Original post by MJP
Quote:Original post by Gauvir_Mucca
Is this a well-documented bug/feature that MS acknowledges and suggests as the fix for?


It's not a "bug", it's a natural result of bilinear filtering. The only way to make sure that only the texels within your rectangle get sampled is to use POINT for your MagFilter and MinFilter. If you want bilinear filtering, you'll need to add a gutter around your image as others have suggested.


Ok, so I don't want bilinear filtering. I try calling this before rendering:

pD3DDevice9->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);pD3DDevice9->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);


But my problem still remains. What am I doing wrong?
Advertisement
Quote:Original post by Gauvir_Mucca
Quote:Original post by MJP
Quote:Original post by Gauvir_Mucca
Is this a well-documented bug/feature that MS acknowledges and suggests as the fix for?


It's not a "bug", it's a natural result of bilinear filtering. The only way to make sure that only the texels within your rectangle get sampled is to use POINT for your MagFilter and MinFilter. If you want bilinear filtering, you'll need to add a gutter around your image as others have suggested.


Ok, so I don't want bilinear filtering. I try calling this before rendering:

*** Source Snippet Removed ***

But my problem still remains. What am I doing wrong?


Never mind, I need to make those calls AFTER the call to pD3DXSprite->Begin(). Any reason why? It seems like making the call to SetSamplerState() should affect anything afterwards (unless a later call contradicts it). Does pD3DXSprite->Begin() automatically set bilinear filtering?
Quote:Original post by Gauvir_Mucca
Never mind, I need to make those calls AFTER the call to pD3DXSprite->Begin(). Any reason why? It seems like making the call to SetSamplerState() should affect anything afterwards (unless a later call contradicts it). Does pD3DXSprite->Begin() automatically set bilinear filtering?


The reason why is because ID3DXSprite->Begin() sets sampler states of its own, including enabling bilinear blending.
Quote:Original post by Gauvir_Mucca
Quote:Original post by Gauvir_Mucca
Quote:Original post by MJP
Quote:Original post by Gauvir_Mucca
Is this a well-documented bug/feature that MS acknowledges and suggests as the fix for?


It's not a "bug", it's a natural result of bilinear filtering. The only way to make sure that only the texels within your rectangle get sampled is to use POINT for your MagFilter and MinFilter. If you want bilinear filtering, you'll need to add a gutter around your image as others have suggested.


Ok, so I don't want bilinear filtering. I try calling this before rendering:

*** Source Snippet Removed ***

But my problem still remains. What am I doing wrong?


Never mind, I need to make those calls AFTER the call to pD3DXSprite->Begin(). Any reason why? It seems like making the call to SetSamplerState() should affect anything afterwards (unless a later call contradicts it). Does pD3DXSprite->Begin() automatically set bilinear filtering?


It sure does. There's a list of all sampler/render/texture states it sets in the documentation.

I'm marking this thread as solved. Thanks for your help guys.

This topic is closed to new replies.

Advertisement