Tutorial 1: setting up DirectX 11 with Visual Studio

Source: Internet
Author: User
Tags visual studio 2010

 

Before writing any graphics code we'll need to have the tools to do so. the first of these tools is a compiler that is preferably built into a nice IDE. the one I use and will be
Supplying project files for is Visual Studio 2010. There are several others available and some are even free off the net. I'll leave that up to you to decide which one you prefer.

The second tool you will need is the DirectX SDK. It can be downloaded from Microsoft's website for free. After downloading and installing the SDK you will have the files necessary
To compile DirectX programs. you will also notice it comes with samples, tools, and documentation. the documentation is pretty good, it also has some very simple examples under the DirectX 10 tutorials section which also applies to DirectX 11. the tools that
Come with it are also useful, we'll be using the DDS texture tool quite often. the sample browser also provides some simple examples to achieve certain effects you may be looking to do. the samples will generally also have some of the new features of the latest
SDK demonstrated.

With both installed you can now setup your ide to work with the DirectX 11 SDK. Please note that some ides will need to be installed first before installing the DirectX SDK.

Setting up Visual Studio 2010

In Visual Studio 2010 I used the following steps:

First you need to create an empty Win32 project so select file-> New-> project. Then select Win32 project from the choices. Give the project a name (I called mine engine) and
Location and then click on "OK ". click "Next" and you will be given another menu. under "Additional Options" put a check mark in the "Empty Project" box and click on "finish" and then click "Next ". you shoshould now have an basic Win32 Empty Project setup.

Now click "View" from the menu and select "Property Manager ".

Next click on the arrow to the left of your project name (mine was called engine) in the property manager window on the left part of the screen. This will display the solution executions
You have.

Select the "Debug | Win32" folder and double click "Microsoft. cpp. win32.user ".

In the window that pops up select "VC ++ directories" from the menu on the left side. This will then display the directories that the project uses.

Now select "include directories" from the directory list and click on the down arrow that appears to the left. From the choices it pops up choose "edit ".

Click on the folder icon at the top (called new line if you mouse over it) and click on the "..." that appears to the right side.

Navigate to the DirectX SDK include folder, different versions are named differently but on my system it was: C: \ Program Files (x86) \ Microsoft DirectX SDK (June 2010) \ include

Next click on "select folder" and then click "OK ".

The libraries directory is also needed so now select "library directories" from the directory list and click on the down arrow that appears to the left. From the choices it pops
Up choose "edit ".

Click on the folder icon at the top (called new line if you mouse over it) and click on the "..." that appears to the right side.

Navigate to the DirectX SDK library folder, different versions are named differently but on my system it was: C: \ Program Files (x86) \ Microsoft DirectX SDK (June 2010) \ Lib \ x86

Next click on "select folder" and then click "OK ".

Finally click on the "Apply" button in the bottom right of the property pages window.

Now click "OK" to close the window and your settings will be complete. From the menu click "View" and then "Solution Explorer" to return to your code. All DirectX projects shoshould
Now compile fine and the error of "cannot open include file: 'd3d11. h': no such file or directory "shocould disappear. also note that these settings will automatically be applied to the release | Win32 solution configuration so you don't need to set them there.
As well it shoshould be persistent permanently for all new projects and will never need to be setup again.

Setting up Visual Studio 2008

In Visual Studio 2008 I used the following steps:

Click "Tools" from the menu.

Select "options" at the bottom of the list.

Click "projects and Solutions" from the list on the left side.

Click "VC ++ directories" from the expanded list.

On the right side under "show directories for:" select the drop down choice "include files ".

Now add the location of the include directory to the top of the list. on my setup it was the following but may be different on yours (month released, etc .), make sure to double check:

C: \ Program Files (x86) \ Microsoft DirectX SDK (June 2010) \ include

After you have added that include directory you now need to add the library directory also. On the right side under "show directories for:" select the drop down choice "library files ".

On my setup it was the following but may be different on yours (month released, etc.), make sure to double check:

C: \ Program Files (x86) \ Microsoft DirectX SDK (June 2010) \ Lib \ x86

With these two directories setup in Visual Studio you shoshould now be able to compile DirectX 11 code without any issues.

To do exercises

1. Compile and run tutorial #2 from the DirectX 11 SDK documentation (source is located: (SDK root) \ samples \ c ++ \ direct3d10 \ tutorials \ tutorial02)

Back to tutorial Index

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.