Game Development Reference
In-Depth Information
Drawing the model
Once everything has been created and loaded, we can look at drawing the vertices to
the screen using the specified shader. There are a couple of steps before which we
can call the Draw() method; however, these are all simple method calls to indicate
we will use each resource.
Note
A quick note on topology
Topology defines how Direct3D will read and interpret the provided indices or ver-
tices to lay out the mesh. When drawing the mesh, it can be optimized to re-
duce the number of required vertices and indices by reusing the last two indices
when drawing. This is referred to as a triangle strip . Consuming and using the
vertices and indices as originally described would involve a triangle list, which is
the simplest and often most compatible topology that can be used for drawing tri-
angles, as a strip requires extra processing to ensure the order is correct without
breaking the model.
Other options such as lines and points also exist, and these notify Direct3D that
you don't want shaded triangles to be drawn. Instead, the vertices should be
drawn as points, or lines between vertices, allowing for different techniques to be
used. This would be a good option if you were looking to draw a wireframe, as you
can construct the data using two vertices (or indices) for each line and draw them
without having to worry about how to draw lines using rectangles and triangles.
This is a list of commonly used primitive topologies, as defined in the
D3D_PRIMITIVE_TOPOLOGY enumeration:
D3D11_PRIMITIVE_TOPOLOGY_POINTLIST
D3D11_PRIMITIVE_TOPOLOGY_LINELIST
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST
D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP
Search WWH ::




Custom Search