Sign in to follow this  
neal8929

Sprites edges blend

Recommended Posts

neal8929    122
SOLVED:
I solved this by changing samplerstate like this.
d3ddev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_NONE);
d3ddev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_NONE);
Also I had to make my image size a power of 2. Now it looks like a sprite is supposed to look!


Ok my problem is with drawing sprites. It works just fine with my code below... However the sprites are a little bit fuzzy and when you take a printscreen and zoom in on the image you can see that the edges of the sprite blend with the background image, which causes the fuzzy look. I dont want this and do not know what is causing it.


[code]
void initD3D(HWND hWnd)
{
...
// setup texture
if (! D3DXCreateTextureFromFile(d3ddev,"man.png", &gTexture) == D3D_OK)
MessageBox (hWnd,"error loading texture.",NULL, MB_OK);

// setup sprite
if (! D3DXCreateSprite(d3ddev, &sprite) == S_OK)
MessageBox (hWnd,"error creating sprite.",NULL, MB_OK);

}
[/code]

And here is my code to draw the image to the top left of the screen. I call this function in between BeginScene() and EndScene().

[code]
void DrawSprite ()
{

sprite->Begin(D3DXSPRITE_ALPHABLEND);
sprite->Draw(gTexture,NULL,NULL,NULL,0xFFFFFFFF);
sprite->End();
}
[/code]

Share this post


Link to post
Share on other sites
neal8929    122
[quote name='Servant of the Lord' timestamp='1310684783' post='4835473']
I don't use DirectX, but what you are describing is sometimes called 'anti-aliasing'.
Maybe [url="http://social.msdn.microsoft.com/Forums/en/gametechnologiesdirectx101/thread/0ed6b535-90d6-4768-a41b-dd68b805b002"]this[/url] solves your problem?
[/quote]

link does not work, but yes it seems like anti-aliasing.

Share this post


Link to post
Share on other sites
[quote name='neal8929' timestamp='1310688473' post='4835492']
link does not work, but yes it seems like anti-aliasing.
[/quote]
Odd; works for me. Try this one: [url="http://bit.ly/oiOaVn"]http://bit.ly/oiOaVn[/url]

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