-
October 29th, 2009, 01:02 AM
#1
blending & alpha blending in D3D10
hi!
I am trying to learn D3D10, but I'm having some problems.
1. Can you please explain to me what is blending and what is alpha-blending?
2. I have a background image and some sprites. The sprites are loaded from a file, 32bit BMP, and have transparent areas (which is, alpha). the code I wrote, and didn't work, was:
Code:
ID3D10BlendState* pBlendState10 = NULL;
D3D10_BLEND_DESC StateDesc;
ZeroMemory(&StateDesc, sizeof(D3D10_BLEND_DESC));
StateDesc.AlphaToCoverageEnable = FALSE;
StateDesc.BlendEnable[0] = TRUE;
StateDesc.SrcBlend = D3D10_BLEND_SRC_ALPHA;
StateDesc.DestBlend = D3D10_BLEND_INV_SRC_ALPHA;
StateDesc.BlendOp = D3D10_BLEND_OP_ADD;
StateDesc.SrcBlendAlpha = D3D10_BLEND_ZERO;
StateDesc.DestBlendAlpha = D3D10_BLEND_ZERO;
StateDesc.BlendOpAlpha = D3D10_BLEND_OP_ADD;
StateDesc.RenderTargetWriteMask[0] = D3D10_COLOR_WRITE_ENABLE_ALL;
pD3DDevice->CreateBlendState(&StateDesc, &pBlendState10);
FLOAT NewBlendFactor[4] = {0,0,0,0};
pD3DDevice->OMSetBlendState(pBlendState10, NewBlendFactor, 0xffffffff);
Can somebody please tell me why it didn't work, and what it means? I couldn't figure out from SDK documentation how the operation works. if I exchange SrcBlend with DestBlend why does the sprite dissapear, while if it is so it does not? for me Src + Dest = Dest + Src. (operation add). I can't also understand what the BLEND_ZERO, BLEND_ONE, ... are and how they can be used. and how the operations can be used.
please help.
-
October 31st, 2009, 04:34 AM
#2
Re: blending & alpha blending in D3D10
ok... I believe that my video adapter does not support 2 separate blendings. but why doesn't the reference drive type support it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|