• Advertisement

Archived

This topic is now archived and is closed to further replies.

D3D Sprites - Whats going on here?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey All, Im displaying a sprite on screen using the D3DX functions. I load it: D3DXCreateTextureFromFile and pass it in the flags, a dword containing D3DX_TEXTURE_NOMIPMAP I later on display it using D3DXDrawSpriteSimple Easy? My problem is this - the image I am displaying is dark blue with a cyan stripe going down the right hand side. When DirectX displays it, i notice that it has a faint cyan stripe down the left hand side too. If I display a bitmap which has the cyan stripe along the bottom, I notice a faint cyan stripe along the top when DirectX displays it. I am assuming this is a problem with DX ''anti-aliasing'' the sprite? Any pointers would be awesome! regards, GeniX

Share this post


Link to post
Share on other sites
Advertisement
Try turning off ALL filtering when you draw those sprites.
That is, use "nearest" instead of "bilinear", "trilinear" or whatever you might have. I don''t remember which state you should use, so read the docs...
(well, disabling wrapping might help too...)

Share this post


Link to post
Share on other sites
Yay,

I had thought of that, but assumed it would be a mipmap or such.

But when you mentioned "filter" I searched the dx docs for filter. Turns out that the D3DXPrepareDeviceForSprite (if i recall correctly) turns on a whole bunch of texture stage filters.
One of them was a filter applied to sprites which are not full size, and was set to LINEAR. I changed it to POINT and it works fine (altho it doesnt look as nice without the smoothing

Thanks a lot for your help



regards,

GeniX

Share this post


Link to post
Share on other sites
The Tip with changing the Wrapping should be the better way.
You can disable texturewrapping by using :
    
// Disable

D3DDevice->SetTextureStageState(D3DTSS_ADDRESS,D3DTADDRESS_CLAMP);
//Enable

D3DDevice->SetTextureStageState(D3DTSS_ADDRESS,D3DTADDRESS_WRAP);


With this you get smoothed Sprites, without the colors on the wrong places.

Lars

Edited by - Lars W. on June 26, 2000 9:42:59 PM

Share this post


Link to post
Share on other sites

  • Advertisement