| As
powerful as it is, DirectX only has the ability to draw one type of primitive
-> a triangle. This is not much of a limitation, since any polygonal structure
can be represented as a set of triangles. In lab 1, you drew a square using
two triangles. In this lab, you will output a cube to screen. A cube has
six faces, and therefore can be represented by twelve triangles. Doing this
the brute force way, you would need 12 x 3 = 48 vertices just to draw a
cube. However, there is a more efficient way to draw structures that share
vertices. Fill in the vertex buffer as you normally would -> with 8 vertices
for the cube. Now, youll need to make use of the index buffer. Using the
index buffer you can assign any set of vertices to a triangle face. So the
first face would be vertices 1,2 and 3; the second would be 2,3,and 4, and
so on..... |