D3D11 SDK Tutorial question

Started by
1 comment, last by keiokrysha 11 years, 7 months ago
In the SDK tutorials, some of them use .fx files to store shaders information, take Tutorial04 as an example, it has the .fx file "Tutorial04.fx",
[color=#ff0000]Can anybody tell me why if I create a .fx file with the same content(copy/paste from "Turotial04.fx") but different title, then change the two places in the code where the file title are used:
[source lang="cpp"]hr = CompileShaderFromFile( L"Tutorial04.fx", "PS", "ps_4_0", &pPSBlob );[/source]
Change L"Tutorial04.fx" to new .fx file tile
[source lang="cpp"]hr = CompileShaderFromFile( L"Tutorial04.fx", "VS", "vs_4_0", &pVSBlob );[/source]
Change L"Tutorial04.fx" to new .fx file title
Then the program pops up an error message? "
[source lang="java"]if( FAILED( hr ) )
{
MessageBox( NULL,
L"The FX file cannot be compiled. Please run this executable from the directory that contains the FX file.", L"Error", MB_OK );
return hr;
}[/source]

That says only a .fx file with title "Tutorial04" will work here, I guess it has something to do with the resource.h and Tutorial04.rc files, but I do not know what it is. Can anybody help? Thanks.
Advertisement
If you're lucky it might just be in the wrong folder. If you run your app from Visual Studio the current working directory where the app will look for files is in the project folder.
Usually it looks like this by default when you create a new project:
- Visual Studio Projects
- - ProjectName
- - - ProjectName
- - - - program.cpp
- - - - Tutorial04.fx

If you double-click your built .exe in Windows, place the .fx file in the same folder as the .exe instead.
Hi Erik Rufelt, you are absolutely correct, I checked the project folder and there was not any .fx file, it was on my desktop, I just dragged it into the "Solution Explorer" in my Visual Studio 2010, after I put it in the project folder, the program can continue, however I am encoutering a new problem now, which I have post in another thread. Thank you very much!

This topic is closed to new replies.

Advertisement