Original Post
I am getting frustrated, all I want is to be able to specify one color in my texture to be transparent. I am using alpha testing, but I must be missing something here because it''s not working... Can someone please point me in the right direction?
Thanks,
Matt
My image loading code:
This is my rendering code:
D3DXCreateTextureFromFileEx( g_pd3dDevice, imageFileName,
D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN,
D3DPOOL_DEFAULT, D3DX_DEFAULT,
D3DX_DEFAULT, 0, NULL, NULL,
&pTexture )
g_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
g_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, TRUE );
g_pd3dDevice->SetRenderState( D3DRS_ALPHAREF, 0x01 );
g_pd3dDevice->SetRenderState( D3DRS_ALPHAFUNC, D3DCMP_GREATEREQUAL );
g_pd3dDevice->SetTexture( 0, creatures.pTexture);
g_pd3dDevice->SetStreamSource( 0, pVB, 0, sizeof(CUSTOMVERTEX) );
g_pd3dDevice->SetFVF( D3DFVF_CUSTOMVERTEX );
g_pd3dDevice->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 2);
g_pd3dDevice->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );