2D rendering in D3D : Alpha-blending problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

2D rendering in D3D : Alpha-blending problem

tony0tony0 Posts: 7Member
Hi:

I have a question about alpha-blending of D3d, i believe you can help me.
usually , we set some parameters using SetRenderState and SetTextureStageState like this:
g_D3DDevice->SetRenderState (D3DRS_ALPHABLENDENABLE, True)
g_D3DDevice->SetRenderState (D3DRS_SRCBLEND, D3DBLEND_SRCALPHA)
g_D3DDevice->SetRenderState (D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA)
g_D3DDevice->SetTextureStageState (0, D3DTSS_ALPHAOP, D3DTOP_MODULATE)
g_D3DDevice->SetTextureStageState (0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE)
g_D3DDevice->SetTextureStageState (0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE)
If SrcAlpha=70%, then DstAlpha=30%(because of D3DBLEND_INVSRCALPHA parameter), but how can i set SrcAlpha=70% and DstAlpha=60%? I tried to change D3DBLEND_INVSRCALPHA to D3DBLEND_DESTALPHA, but i don't know how to set destalpha of D3D render target surface.

Thanks a lot!

Tony

Sign In or Register to comment.