Book Image

Direct3D Rendering Cookbook

Book Image

Direct3D Rendering Cookbook

Overview of this book

Table of Contents (19 chapters)
Direct3D Rendering Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Further Reading
Index

Rendering primitives


Now that we have our rendering framework ready, we can finally work on the more interesting stuff—actually rendering something!

All rendered objects, at their simplest form, are made up of one or more primitives: points, lines, or triangles which are made up of one or more vertices. In this recipe, we will render the following primitives:

  • A set of colored arrows representing the x, y, and z axes (red, green, and blue) using lines

  • A triangle using a triangle

  • A quad (made up of two triangles)

We will also implement our WVP matrix and see how multisampling affects the rendered image. The final result is shown in the following figure:

Rendering primitives final output

Getting ready

We'll start by creating a new Windows Form Application project named Ch02_01RenderingPrimitives in the D3DRendering.sln solution:

  1. Add the SharpDX.dll, SharpDX.DXGI.dll and SharpDX.Direct3D11.dll references like we did in the previous recipes.

  2. Next, we will add a reference to .\External\bin\SharpDX.D3DCompiler...