Hi,
I am not understanding why my load texture function is returning NULL when I run it. The file is in the correct place but it just isn't loading.
the prototype
ID3D10Texture2D *loadTexture2DFromFile (LPCWSTR filename);
the call
// load textures
g_pTexture1 = loadTexture2DFromFile (TEXT(".\\spaceAce.bmp"));
the function
//
// getTexture2DFromFile
// loads a 2D texture object to memory and returns a pointer to it
//
ID3D10Texture2D *loadTexture2DFromFile (LPCWSTR filename)
{
// local variables
ID3D10Texture2D *pTexture = NULL;
ID3D10Resource *pResource = NULL;
// local declarations
HRESULT hr = D3DX10CreateTextureFromFile (g_pD3D10Device, filename, NULL, NULL, &pResource, NULL);
if (FAILED(hr))
{
MessageBox(NULL, filename, L"Texture Load Failure", MB_OK);
return NULL;
}
pResource->QueryInterface(__uuidof(ID3D10Texture2D), (LPVOID*) &pTexture);
pResource->Release();
// return
return pTexture;
}
when I run the code I get the Messagebox error message with the path of the bmp that I am trying to load. What have I done wrong?