   Help with D3DXSPRITE and Alphablending.
  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]
  try to change m_RenderList[count]->m_ColourKey to 0x40ffffff and then 0x10ffffff (write manually) and then see what happens, maybe you aren't using color in the right way...In your example instead of m_RenderList[count]->m_ColourKey you are using m_ColourKey ? (I see it is uncommented)   ;  Thanks for the response.Sorry, I just put the m_ColourKey in the comments to show how I was setting the ColourKey being used. I'll edit it so it's a bit clearer.That same thing is happening with the hex values. :(   ;  I think that when you use D3DXSPRITE_OBJECTSPACE you need to reset alpha blending states but I'm not sure. Try to modify alpha blending states and see what you got...;  Or you can just bypass all that stuff and use a shader.. this is the easiest method, because you have perfect control.just use D3DXSPRITE_DO_NOT_MODIFY_RENDERSTATES and draw your sprites inside the effect pass.   ;  Thanks for all the replies, much appreciated.I'm a complete idiot. :)It was nothing to do with the alphablending or the render states or anything like that. I was registering objects to be rendered but not clearing the render list after drawing. So the same texture was being drawn over itself thousands of times, which made me think alpha blending was going crazy.Oh well, another learning experience. :)