Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
2D rendering in D3D : Alpha-blending problem
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!