Hello guys, this is like second time when Im asking for help on forums. But Im totally newbie in DX or D3D programming, so please dont see me like an total idiot, I know I am.
So I have the following code :
LPDIRECT3DTEXTURE9 pTEX = NULL;
pTEX = player->m_pRank->GetTexture(m_bRank+1);
D3DXMATRIX ICON;
D3DXMATRIX vROTACE;
D3DXMatrixScaling(
&vROTACE,
32,
32,
32);
D3DXMatrixRotationX(
&vROTACE,
-D3DX_PI / 2.0f);
ICON *= vROTACE;
ICON._41 = vCOORDS.x
ICON._42 = vCOORDS.y
ICON._43 = vCOORDS.z;
ICON._41 = (ICON._41 - 7.0f);
Device->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
Device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
Device->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
Device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
Device->SetRenderState(D3DRS_ALPHABLENDENABLE,TRUE);
Device->SetRenderState(D3DRS_BLENDOP, D3DBLEND_ONE);
Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
Device->SetStreamSource( 0, m_vTRECTVB.GetVB(), 0, sizeof(PVERTEX));
Device->SetTransform( D3DTS_WORLD, &ICON);
Device->SetTexture(0, pTEX);
Device->DrawPrimitive( D3DPT_TRIANGLESTRIP, 0, 2);
It works well, but there is one problem. Im rendering it from image, which has got transparent background. But when I render it to the texture (I can post the code), it renders it to square, and there begin the problem. When I rotate the camera to some light or effect, you can see throught it (the light) and the corners are clearly visible. Illustration image : http://prntscr.com/advv5q So my question is : Is it possible to render the texture with totally transparent background or is it possible to render the image into the texture, without making square for it, so the texture will be just the image? Thanks for reply.