Jump to content
  • Advertisement


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


D3DXSprite Problems

This topic is 6187 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

First of all, I''ve never used this board before (been using xgame3d.com until it went down over a week ago and is yet to come back up). So, I''ve been using the D3DXSprite functions for about a week now and have noticed that the texture is always linearly filtered. That''s all nice and all, but when using 1 alpha bit a halo appears around every sprite since the newly interpolated alpha equates to 1/2 alpha. Add that to the color (white) that targas use for pixels with an alpha value of 0, and you get a visible halo. After looking everywhere on the web, including a couple visits to the microsoft newsgroups, I''ve come to the conclusion that a lot of people have been having problems with D3DXSprite and no one has any real answers (other than pointing out the obvious RECT error that everyone should have known about since ''97). This is what I''ve found while looking through d3dxsprite.h: D3DXSprite::Begin() sets the following render/texture states: SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE); SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE); SetTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_LINEAR); SetTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR); SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE); SetRenderState(D3DRS_ZENABLE, TRUE/FALSE); Depending on the value of ZEnable parameter So, in order to fix my problem (and problems that others have encountered) you simply set the render/texture states that you need after calling D3DXSprite::Begin(). Hope this helps anyone out there whose been having problems. Bill6

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!