title: The function CreateWICTextureFromFile() will not actually load a texture (Direct3D11, C++)
body: <p>I am trying to load a grass texture onto my game with the function <code>DirectX::CreateWICTextureFromFile</code> but everytime I do, the function won't seem to actually load anything, it just loads a black texture. The function successfully returns <code>S_OK</code>, and i've also called the <code>CoInitialize(NULL)</code> before I actually call the function. But it still doesn't work.</p>
  
  <p>Down below is my usage of the function</p>
  
  <pre><code>// This is where i load the texture
  void Load_Texture_for_Ground()
  {
  HRESULT status;
  ID3D11ShaderResourceView * Texture;
  
  CoInitialize(NULL);
  
  status = DirectX::CreateWICTextureFromFile(device, L"AmazingGrass.jpg", NULL, &amp;Texture);
  
  if (Texture != NULL)    // This returns true
  {
      MessageBox(MainWindow, L"The pointer points to the texture", L"MessageBox", MB_OK);
  }
  
  if (status == S_OK)   //This returns true
  {
      MessageBox(MainWindow, L"The function succeeded", L"MessageBox", MB_OK);
  }
  
  CoUninitialize();
  }
  
  // This is where i actually load the texture onto an object, assuming i already declared all the variables in this function
  void DrawTheGround ()
  {
  
  DevContext-&gt;VSSetShader(VS, 0, 0);      
  
  DevContext-&gt;PSSetShader(PS, 0, 0);  
  
  DevContext-&gt;IASetVertexBuffers(
                              0,                  
                              1,                  
                              &amp;GroundVertexBuffer,
                              &amp;strides,           
                              &amp;offset             
                              );
  DevContext-&gt;IASetIndexBuffer(
                          IndexBuffer,            
                          DXGI_FORMAT_R32_UINT, 
                          0
                          );
  
          /* Transforming the matrices*/
  TransformedMatrix = GroundWorld * CameraView * CameraProjection ;
  
  Data.WORLDSPACE = XMMatrixTranspose(GroundWorld);
  
  Data.TRANSFORMEDMATRIX = XMMatrixTranspose(TransformedMatrix);
  
          /* Updating the matrix in application's Constant Buffer*/
  DevContext-&gt;UpdateSubresource(
                          ConstantBuffer,                 
                          0,                              
                          NULL,                           
                          &amp;Data,                          
                          0,                              
                          0                               
                          );
  
  DevContext-&gt;VSSetConstantBuffers(0, 1, &amp;ConstantBuffer);
  
  DevContext-&gt;PSSetShaderResources(0, 1, &amp;Texture);
  
  DevContext-&gt;PSSetSamplers(0, 1, &amp;TextureSamplerState);
  
  DevContext-&gt;DrawIndexed(6, 0, 0);
  
  }
  </code></pre>
  
  <p>What could be wrong here? Why won't the function load the texture?</p>