D3D9 Alpha Blending on the surfaces
Posted
by
Indeera
on Game Development
See other posts from Game Development
or by Indeera
Published on 2012-04-05T09:36:06Z
Indexed on
2012/04/05
11:44 UTC
Read the original article
Hit count: 303
directx9
I have a surface (OffScreenPlain or RenderTarget with D3DFMT_A8R8G8B8) which I copy pixels (ARGB) to, from a third party function. Before pixel copying, Bits are accessed by LockRect.
This surface is then StretchRect to the Backbuffer which is (D3DFMT_A8R8G8B8). Surface and Backbuffer are different dimensions. Filtering is set to D3DTEXF_NONE.
Just after creating the d3d device I've set following RenderState settings
D3DRS_ALPHABLENDENABLE -> TRUE
D3DRS_BLENDOP -> D3DBLENDOP_ADD
D3DRS_SRCBLEND -> D3DBLEND_SRCALPHA
D3DRS_DESTBLEND -> D3DBLEND_INVSRCALPHA
But I see no alpha blending happening. I've verified that alpha is specified in pixels.
I've done a simple test by creating a vertex buffer and drawing a triangle (DrawPrimitive) which displays with alpha blending.
In this test surface was StretchRect first and then DrawPrimitive, and the surface content displays without alpha blending and the triangle displays with alpha blending.
What am I missing here? Thanks
© Game Development or respective owner