Implementing texture sampling

In this recipe we are going to take the quad and triangle renderers from the previous example and apply some texture using a shader resource view (SRV), a sampler state object, and changes to the shader program.

The final output from the example will look something like the following figure:

Implementing texture sampling

Textured triangle and quad

Getting ready

For this recipe, we will continue from where we left of in the Rendering primitives recipe.

There are two texture files included with the sample code that you will also need. Alternatively, you may use any BMP, JPG, PNG, or even DDS formats. For reference, the two textures used in this project ...

Get Direct3D Rendering Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.