Hi,
I'm getting some really strange behaviour from ID3DXSprite->Draw() when using Alpha Blending and I can't figure out what is going on.
Relavent code below:
Loading the texture:
CreateTexErr = D3DXCreateTextureFromFileEx(
m_pDevice,
_pFileLoc,
D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2,
D3DX_DEFAULT,
0,
D3DFMT_A8R8G8B8,
D3DPOOL_MANAGED,
D3DX_FILTER_NONE,
D3DX_DEFAULT,
_ColourKey,
&pNewTexture->SrcFileInfo,
NULL,
&pNewTexture->pTexture);
Starting the drawing:
m_pSpriteInterface->Begin(D3DXSPRITE_OBJECTSPACE | D3DXSPRITE_ALPHABLEND);
Drawing the sprite:
// m_RenderList[count]->m_ColourKey = D3DCOLOR_RGBA(255,255,255,255);
m_pSpriteInterface->Draw(
m_pTextureManager->GetTexture(m_RenderList[count]->m_TextureID),
0,
0,
&m_RenderList[count]->m_Center,
m_RenderList[count]->m_ColourKey);
The problem...
I'm assuming that as the alpha value in the D3DCOLOR_RGBA() macro is lowered towards 0, the more transparent the image should get, but this isn't happening. As I lower the alpha value, the sprite stays completely unchanged until an alpha value of about 10-15 where it will gradually get a little bit more transparent (but not much) and then at the value of 1 the texture will no longer be drawn. I'm obviously doing something stupid here, I've been trying to figure it out for a good few hours with no luck.
I've tried adding the usual renderstates, enabling alpha blending, etc, but nothing seems affect what it is doing at the moment.
Any help is much appreciated.
[Edited by - Boonio on September 17, 2007 2:13:45 PM]