Archived

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

CutterSlade

D3DXSprite and Additive Blending

Recommended Posts

I'm trying to ge additive blending to work with my sprites [for particles and such] but no such luck so far. Here's my code
Graphics->GetD3DXSprite()->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_DEPTH_BACKTOFRONT);
		
Graphics->GetD3DDevice()->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE );
Graphics->GetD3DDevice()->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
		
Sprite->Draw(Graphics);
			
		
Graphics->GetD3DXSprite()->End();

Graphics->GetD3DDevice()->EndScene();
The Draw method of Sprite only calls the D3DXSprite's Draw. However, when I draw my sprite this way, all the screen goes white... I can't see what's wrong, any clues? Thanks in advance --------------------------------------------------------- There are 10 kinds of people: those who know binary and those who don't [edited by - CutterSlade on April 5, 2004 10:00:12 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by CutterSlade

Graphics->GetD3DXSprite()->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_DEPTH_BACKTOFRONT);



The Draw method of Sprite only calls the D3DXSprite''s Draw. However, when I draw my sprite this way, all the screen goes white... I can''t see what''s wrong, any clues?



I''ve experienced trouble with D3DXSPRITE_SORT_DEPTH_BACKTOFRONT, have you tried removing it and see if it works?

Share this post


Link to post
Share on other sites
Just tried it now, but didn''t change a thing...

---------------------------------------------------------
There are 10 kinds of people: those who know binary and those who don''t

Share this post


Link to post
Share on other sites
Then how exactly would I do a simple additive blending?

---------------------------------------------------------
There are 10 kinds of people: those who know binary and those who don''t

Share this post


Link to post
Share on other sites
set the D3DRS_BLENDOP to D3DBLENDOP_ADD, the D3DRS_SRCBLEND to D3DBLEND_SRCCOLOR, and the D3DRS_DESTBLEND to D3DBLEND_DESTCOLOR. setting both blend operands to 1 is bound to get you pure white.

also, is this managed DX or something? i''m using DX9b with C++ and D3DXSprite::Begin() does not accept any parameters.. not to mention there is no way for me to chain together interfaces like that (GetD3DXSprite->Begin() for example).

Share this post


Link to post
Share on other sites
Woohoo, it works, thanks a bunch!! =D
I''m not using managed DX. I''m using the Summer 2003 update SDK, maybe that''s the difference.

---------------------------------------------------------
There are 10 kinds of people: those who know binary and those who don''t

Share this post


Link to post
Share on other sites