Hi guys,
Hopefully a simple question.
I am currently displaying a png image happily, but I am wondering how to enable alpha blending (as my texture has a transparent channel)
Thanks in advance (again)
Hi guys,
Hopefully a simple question.
I am currently displaying a png image happily, but I am wondering how to enable alpha blending (as my texture has a transparent channel)
Thanks in advance (again)
Got it!
Just had to do this...
ID3D11BlendState* d3dBlendState;
D3D11_BLEND_DESC omDesc;
ZeroMemory( &omDesc,
sizeof( D3D11_BLEND_DESC ) );
omDesc.RenderTarget[0].BlendEnable =
true;
omDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
omDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
omDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
omDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
omDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
omDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
omDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
if( FAILED( d3dDevice->CreateBlendState( &omDesc, &d3dBlendState ) ) )
return false;
d3dContext->OMSetBlendState( d3dBlendState, 0, 0xffffffff );