here is how I draw 2d transparent sprites.
I make a quad with four vertices rendered as a triangle strip with a texture.
the vertex format is D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1
the z-buffer and lighting are disabled.
and this is how i setup the blending.
m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
before rendering the textured quad(s).
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
and after
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
Popular Topics
Advertisement