D3DXSprite and Additive Blending

Started by
6 comments, last by CutterSlade 20 years ago
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]
--------------------------------------------------------- There are 10 kinds of people: those who know binary and those who don't
Advertisement
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?
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
--------------------------------------------------------- There are 10 kinds of people: those who know binary and those who don't
You shouldn''t need to set the srcblend or dstblend states.

I like pie.
[sub]My spoon is too big.[/sub]
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
--------------------------------------------------------- There are 10 kinds of people: those who know binary and those who don't
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).
_______________________________________________________________________Hoo-rah.
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
--------------------------------------------------------- There are 10 kinds of people: those who know binary and those who don't
ooh. didn''t know about that. i''ll go check it out
_______________________________________________________________________Hoo-rah.

This topic is closed to new replies.

Advertisement