O'Reilly logo

DirectX 11.1 Game Programming by Pooya Eimandar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Compiling and linking to shaders

It's time to write our first shader and introduce how we will employ it in the DirectX application. Open the second project of this chapter from the source code (Shaders). Open the VertexShader.hlsl file from Assets/Shaders; note that in Visual Studio, you can add a shader to the project by going to Add/New Item/HLSL.

Visual Studio compiles the HLSL files and converts them to .cso, which is usually generated in the Debug folder (under ProjectName in the Projects folder) by default. You can change the output directory from the HLSL Property page.

In DirectX 11.1, you can use two ways to compile the shaders. The first and traditional way is to compile the FX files at runtime; we use the D3DCompileFromFile function ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required