I am currently porting parts of my engine over to D3D11 from OpenGL and was trying to figure out how I would accomplish the following blending functions in D3D11.
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glDepthMask(GL_FALSE);
glDepthFunc(GL_EQUAL);
I believe it should be something like this:
D3D11_BLEND_DESC blendDesc;
ZeroMemory(&blendDesc, sizeof(blendDesc));
D3D11_RENDER_TARGET_BLEND_DESC rtbd;
ZeroMemory(&rtbd, sizeof(rtbd));
rtbd.BlendEnable = true;
rtbd.SrcBlend = D3D11_BLEND_ONE;
rtbd.DestBlend = D3D11_BLEND_ONE;
rtbd.BlendOp = D3D11_BLEND_OP_ADD;
rtbd.SrcBlendAlpha = D3D11_BLEND_ONE;
rtbd.DestBlendAlpha = D3D11_BLEND_ONE;
rtbd.BlendOpAlpha = D3D11_BLEND_OP_ADD;
rtbd.RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
blendDesc.AlphaToCoverageEnable = true;
blendDesc.RenderTarget[0] = rtbd;
m_D3D->GetDevice()->CreateBlendState(&blendDesc, &m_blendMode);
However this does not work. How can I achieve the same effect as in the first code snippet?
Thanks
hr = m_D3D->GetDevice()->CreateBlendState(&blendDesc, &m_blendMode);
if ( FAILED(hr) ) ...` – Chuck Walbourn Apr 21 at 18:02