Original English version address: http://www.rastertek.com/dx11tut01.html.
Before writing any graphic code, we need tools to complete it. The first of these tools is a compiler, which is best built into a good IDE. I use and will provide project files for Visual Studio 2010. In addition, there are some that can be used, some even for free. I'll let you decide which one you like
The second tool you need is the DirectX SDK. It can be downloaded for free from Microsoft's website. After downloading and installing the SDK, you will have the files required to compile the DirectX program. You will also notice that it comes with examples, tools, and documentation. The documentation is very good, and there are also some very simple examples below the Directx10 tutorial section, which is also applicable to Directx11. The accompanying tools are also very useful, and we will frequently use the DDS texture tool. The example browser also provides some simple examples to achieve certain effects that you may want to achieve. These examples usually also showcase some new features of the latest SDK
After installing these two software, you can now set up your IDE to use the Directx11 SDK. Please note that some IDEs need to be installed before installing the DirectX SDK
Set up Visual Studio 2010
In Visual Studio 2010, I used the following steps:
Firstly, you need to create an empty win32 project, so choose the file -> New -> project Then select win32 project from the options. Give this project a name (my name is My Engine) and a location, then click "OK". Click "Next" and you will receive another menu. Under "Additional Options", check the "Empty Project" box, click "Finish", and then click "Next". There should be a basic Win32 empty project setting now
Now, click on "View" from the menu and select "Property Manager"
Then, in the Property Manager window on the left side of the screen, click the arrow to the left of the project name (my project name is called Engine). This will display the solution configurations you have
Select the "debug win32" folder, then double-click "microsoft.cpp.win32. user"
In the pop-up window, select "VC+ Directory" from the left menu. Then the directory used by the project will be displayed
Now select "include directories" from the directory list, and then click the down arrow on the left. Select "Edit" from the pop-up options
Click on the folder icon at the top (called a new row if hovering over it), and then click on the "..." displayed on the right
Navigation to the directx sdk include folder, different versions have different names, but in my system it is: C: Program Files (x86) Microsoft DirectX SDK (June 2010) Include
Then click "Select folder", and then click "OK"
We still need a library directory, so now select "Library Directory" from the directory list and click the down arrow on the left. Select "Edit" from the pop-up options
Click on the folder icon at the top (called a new row if hovering over it), and then click on the "..." displayed on the right
Navigation to the directx sdk library folder, different versions have different names, but in my system it is: C: Program Files (x86) Microsoft DirectX SDK (June 2010) Library x86
Then click "Select folder", and then click "OK"
Finally, click the "Apply" button in the bottom right corner of the property page window
Now click "OK" to close the window, and your settings will be completed. Click "View" from the menu, then click "Solution Explorer" to return to the code. All DirectX projects should now compile well, and the error "cannot open include file: 'd3d11. h': no such file or directory" should disappear. Also note that these settings will be automatically applied to the Win32 solution configuration, so you don't need to set them there. Meanwhile, it should be permanent for all new projects and never require resetting
Set up Visual Studio 2008
In Visual Studio 2008, I used the following steps:
Click on "Tools" in the menu
Select "Options" at the bottom of the list
Click on "Projects and Solutions" in the left list
Click on "VC+ Directory" from the extended list
To the right of "Show directories for:", select the dropdown option "Include files"
Now add the location of the include directory to the top of the list. In my settings, your settings may differ (release month, etc.), please make sure to check again:
C: Program Files (x86) Microsoft DirectX SDK (June 2010) Include
After adding the include directory, it is now necessary to add the library directory. To the right of "Show directories for:", select the dropdown option "library files"
In my settings, your settings may differ (release month, etc.), please make sure to check again:
C: Program Files (x86) Microsoft DirectX SDK (June 2010) Lib x86
By setting these two directories in Visual Studio, you should now be able to compile Directx11 code without any issues
Doing exercises
1. Compile and run Tutorial # 2 from the DirectX 11 SDK documentation (source code: (SDK root) Samples C++ Direct3D10 Tutorials Tutorial02).
(If you want to see Chinese translations of other courses, please search in my blog directory. I will take some time to translate all the subsequent courses, depending on my availability.)
Time is rushed, just a rough translation, there may be multiple errors, please understand. Friends, if you find any errors, please feel free to correct them. Please contact us for new licheng16886.