一直在努力寻找解决方案,但结果非常糟糕。
基本上我想绘制一个纹理(它由2个三角形组成,因此它是一个四边形),并使它们具有alpha值(0-255,但0-1也会这样做)。这样我就可以在我希望的时候有淡入/淡出效果。
答案 0 :(得分:2)
找到我的答案: Link to Source
DWORD AlphaValue;
AlphaValue = D3DCOLOR_ARGB(100,255,255,255);
mpDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
mpDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
mpDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
mpDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
mpDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
mpDevice->SetTextureStageState(0, D3DTSS_CONSTANT, AlphaValue);
mpDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CONSTANT);
mpDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
mpDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
pMesh->Draw();