Archived

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

kill

blending problems...

Recommended Posts

I have a problem with blending. I''m not sure what I''m doing wrong. When I use the following states:
  
pDevice -> SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDevice -> SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
[source]
My image is always shown with full opacity, regardless of the alpha value I set at the vertices.

With the following code, however,
[source]
pDevice -> SetRenderState(D3DRS_SRCBLEND, D3DBLEND_INVSRCALPHA);
pDevice -> SetRenderState(D3DRS_DESTBLEND, D3DBLEND_SRCALPHA);
[source]
The alpha blending works, only for full opacity I have to set vertices alpha to 0.0f. Another words, the alpha is 1-alpha, as it should be.

Can someone explain to me why my first example isn''t working?

Thanks.
  

Share this post


Link to post
Share on other sites
make sure you are doing the following:
DXDisplay->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );

[The views stated herein do not necessarily represent the view of the company Eurocom ]

Eurocom Entertainment Software
www.Eurocom.co.uk

The Jackal

Share this post


Link to post
Share on other sites
I didn''t put it in the code sample above, I thought it''s kinda obvious Thanks, though.

Any other ideas?

Share this post


Link to post
Share on other sites
What gfx card do you have ?

Not all cards support all blending modes. Make sure you check the caps (d3dcaps8.SrcBlendCaps and d3dcaps8.DestBlendCaps I believe) before setting the blend factors.

(Although the 1st version seems the most likely to be supported)


-Morten-

Share this post


Link to post
Share on other sites