Search code examples
directxtexturesalphamaskdirectx-9

SOS: Texture is not drawn perfectly


Here is my code.

m_pApp->m_pd3dDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
m_pApp->m_pd3dDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE);
m_pApp->m_pd3dDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);
m_pApp->m_pd3dDevice->SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_TEXTURE);
m_pApp->m_pd3dDevice->SetTextureStageState(1,D3DTSS_COLORARG2,D3DTA_CURRENT);
m_pApp->m_pd3dDevice->SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_ADD);

Texture 0 does not have any alpha information. I want to give alpha value 0 to the color vertex whose value is higher than 0x88. I also want to give value 1 to the vertex whose value is lower than 0x88.

I don't know about texture mask effect.


Solution

  • Oh, Yes. The problem was linked to light. after I set Light the texture was displayed successfully.