Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



This topic is 5816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could anyone help me? I tried to use alphatest, but there is happen nothing! there is part of my code: //first of all I load a texture if (FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, "Sky.jpg", &g_pTexture0))) return false; // Make zero alpha value for all pixels (for example) D3DLOCKED_RECT LockedRect; D3DSURFACE_DESC Desc; UINT* pData; if(FAILED(g_pTexture0->GetLevelDesc(0, &Desc))) return false; if(FAILED(g_pTexture0->LockRect(0,&LockedRect,NULL,D3DLOCK_NO_DIRTY_UPDATE))) return false; for(i=0;iUnlockRect(0))) return false; ... // and part of rendering settings hr = g_pd3dDevice->BeginScene(); if (FAILED(hr)) return hr; g_pd3dDevice->SetVertexShader(MY_VERTEX_FORMAT); g_pd3dDevice->SetTexture(0, g_pTexture0); g_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE ); g_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x00); g_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATER ); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTA_TEXTURE); g_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTA_TEXTURE); g_pd3dDevice->SetStreamSource(0, g_pVB, sizeof(SMyVertex)); g_pd3dDevice->SetIndices(g_pIB,0); g_pd3dDevice->SetVertexShader(MY_VERTEX_FORMAT); g_pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, 0, NumVertices,0,NumIndices/3); g_pd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE); g_pd3dDevice->EndScene(); I don''t know what is wrong, but I anyway see my texture except blank screen (because I set zero alpha value and it should be cutted). Please explain me my mistake.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!