   Problem loading texture files
  Hi,I posted this to the beginers forum but didn't get any help so I am hoping that this second post will be allowed.  Thank youI 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 .bmp listed loads into some example code that I have so I don't think that it is a problem with the image file.  My best guess is that somehow I am not getting the path correct.  Is there some way to post the contents of a HRESULT to a MessageBox for understanding why my function call has failed?the prototypeID3D10Texture2D*loadTexture2DFromFile (LPCWSTR filename);the call// load texturesg_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 variablesID3D10Texture2D*pTexture = NULL;ID3D10Resource*pResource = NULL;// local declarationsHRESULT 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();// returnreturn 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?   
  When your running the code are you running it from within the compiler (start debugging) or running the exe that is created after you compile?Does it still happen if you fully define the file path to the file that you are loading?IE: g_pTexture1 = loadTexture2DFromFile (TEXT("c:/folder/spaceAce.bmp"));If its only happening when you start debugging, theres a pathing issue with how you've set up your project.I found that by default a project created in VS2008 that 'start debug' would call for the files to be in:<drive>\<project path>\<Project Name>\<Project Name> (this is where the Resource files are held)however would compile the executables to be in:<drive>\<project path>\<Project Name>\Debug (for the debug release)So if your using implicit folder pathing, you need to store the resources within the project resource directory if your running the inbuilt debugger and store the resources within the debug folder if you run the executable directly.To output the HRESULT, you will need to append it to a string or similar then output that full string to the message box.so something like (pseudo)hresult = <function returning a hresult>;if (HRESULT == FAILED){std::string tempOutput = "Error occured HRESULT = ";tempOutput.append(HRESULT);MSGBOX(NULL, tempOutput, "HRESULT ERROR", MB_OK);}   ;  The function returns NULL both in debug mode and when I run the "release" build of the code.  Also a full static path being passed to the function doesn't change the behavoir of the program.  I have the .bmp in question in the <project>/<project> folder, the <project>/Release folder and the c:\ folder and the program refuses to load the resource from any location.  Given the location of the NULL return the program isn't even loading as a resource file as this fails before the translation from Resource to 2DTexture  I think it is failing to translate from text to path some how :(   ;  Are you creating your D3D10 device with the debug layer?  Use D3D10_CREATE_DEVICE_DEBUG with CreateDevice.Are you linking with the debug D3DX for D3D10?Use d3dx10d.lib in your link input instead of d3dx10.lib.If you do both of those things, then you should have a relevant message in the debug output when you run your program.  Most likely it is a path problem.   