将一个带alpha的dds图片显示在屏幕上
除了 ID3DXSprite(ID3DXSprite实在太慢了)。除了它,还有别的方法吗?这些方法都调用了哪些函数?
我调用了下面三个函数:
pd3dDevice->SetRenderState (D3DRS_ALPHABLENDENABLE, true);
pd3dDevice->SetRenderState (D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pd3dDevice->SetRenderState (D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
但我使用StretchRect时,显示的结果并不半透明。
求帮助!!!!
[解决办法]
void CRenderSystem::InitDeviceState()
{
m_pD3DDevice->SetRenderState(D3DRS_LIGHTING, FALSE);
m_pD3DDevice->SetFVF(D3DFVF_VERTEX2D);
// 启用融合运算
m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
}