title: DirectX 11 Alpha Blending Not Working
body: <p>Okay, so I have been trying to get Alpha Blending to work in my 3D application but it just doesn't want to happen. I am drawing 2d images with an orthogonal projection at the very end of the rendering loop (depth testing remains enabled) and the image textures have transparent parts but they render black.
  Here is my blending code:</p>
  
  <pre><code>D3D11_BLEND_DESC blendStateDesc; 
  ZeroMemory(&amp;blendStateDesc, sizeof(D3D11_BLEND_DESC));
  blendStateDesc.AlphaToCoverageEnable = FALSE;
  blendStateDesc.IndependentBlendEnable = FALSE;        
  blendStateDesc.RenderTarget[0].BlendEnable = TRUE;
  blendStateDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
  blendStateDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
  blendStateDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
  blendStateDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_SRC_ALPHA;
  blendStateDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_DEST_ALPHA;
  blendStateDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
  blendStateDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
  
  if (FAILED(device-&gt;CreateBlendState(&amp;blendStateDesc, &amp;blendState))) {
  printf("Failed To Create Blend State\n");
  }
  deviceContext-&gt;OMSetBlendState(blendState, NULL, 0xFFFFFF);
  </code></pre>
  
  <p>And if it helps here is the texture description:</p>
  
  <pre><code>D3D11_TEXTURE2D_DESC texDesc;
  texDesc.Width = TextureWidth;
  texDesc.Height = textureHeight;
  texDesc.MipLevels = 1;
  texDesc.ArraySize = 1;
  texDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
  texDesc.SampleDesc.Count = 1;
  texDesc.SampleDesc.Quality = 0;
  texDesc.Usage = D3D11_USAGE_IMMUTABLE;
  texDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
  texDesc.CPUAccessFlags = 0;
  texDesc.MiscFlags = 0;
  </code></pre>
  
  <p>I am only using a single render target and not pre-multiplying alphas inside the shaders. I have looked everywhere and tried all manner of different combinations for the D3D11_BLEND_STATE but nothing has worked. 
  The closest I can get is when I set the AlphaToCoverage to TRUE but then it doesn't work if I change the alpha of the vertices, and I know for what I'm doing AlphaToCoverage should be FALSE.</p>