MULTIMEDIA

# DirectX 10 Game Programming : 3D Primer - Primitive Types

1/12/2013 3:31:29 AM
##### When drawing geometry, Direct3D has the option of interpreting the points you send in multiple ways. By connecting these points in different ways, it affects how your geometry is drawn. For instance, you could declare a series of three points; depending on the primitive type you select, these points could be drawn as either three individual dots or as a line-connected triangle. Based on the primitive type you select, the number of points necessary to draw your object can be greatly reduced. Direct3D offers the following primitive types: Point listsLine listsLine stripsTriangle listsTriangle stripsTriangle fans #### Point Lists A point list consists of a series of points that are not connected in any way. Figure 1 shows a grid containing four distinct points. Each point is defined using X, Y, and Z coordinates. For example, the top-left point would be defined as (1, 6, 0). Figure 1. An example of rendered points using a point list. #### Line Lists Line lists consist of lines constructed by two points, one at each end. The lines within a line list are not connected. Figure 2 shows two lines rendered using a line list. This particular line list is constructed from four vertices. The line on the left is formed using (–6, 5, 0) for the upper coordinate and (–4, 2, 0) for the bottom coordinate. Figure 2. Lines rendered using a line list. #### Line Strips Line strips are a series of connected lines where each additional line is defined by a single vertex. Each vertex in the line strip is connected to the previous vertex for a line. Figure 3 shows how a line list is constructed and rendered. The line list in this figure is constructed using a series of six vertices creating five lines. Figure 3. Lines rendered using a line strip. #### Triangle Lists Triangle lists contain triangles that are not connected in any way and can appear anywhere within your world. Figure 4 shows two individual triangles constructed from six vertices. Each triangle requires three vertices to construct a complete triangle. Figure 4. Triangles rendered using a triangle list. #### Triangle Strips Triangle strips are a series of triangles connected to one another where only one vertex is required to define each additional triangle. Figure 5 shows four triangles created using only six vertices. Figure 5. Triangles rendered using a triangle strip. Triangle strips are constructed first by creating three vertices to define the first triangle. If an additional vertex is defined, lines are drawn between the twopreviously created vertices, forming another triangle. Within Figure 5, the order in which the vertices are created is shown. #### Triangle Fans Triangle fans are a series of triangles that share a common vertex. After the first triangle is created, each additional vertex creates another triangle with one of its points being the first vertex defined. Figure 6 shows how a triangle fan consisting of three triangles is created using only five vertices. The order of the vertices controls what the triangle fan looks like. Figure 6 shows the order in which the vertices are created to construct the displayed fan. Figure 6. Triangles rendered using a triangle fan.
 Other

 Most View
 -  Running a SharePoint Site on Windows Home Server : Working with Site Settings (part 3) - Working with Groups
 -  Fujifilm X-E1 - A Retro Camera That Inspires (Part 3)
 -  Update Your Android Tablet (Part 1)
 -  Buying Guide – Router (Part 3) - Buffalo AirStation 1750, Western Digital My Net N900 Central, Fractal Design Define R4
 -  Gigabyte GeForce GTX Titan Graphics Card
 -  Best TVs – Feb 2013 (Part 3)
 -  Secret Tips For Google Maps (Part 2)
 -  Huawei Ascend G600 - I Wonder Why 600?
 -  Fujifilm FinePix S4800 - Versatile Camera With Large Zoom And Manual Controls (Part 1)
 Top 10
 -  Windows Server 2008 and Windows Vista : Troubleshooting GPOs - Group Policy Troubleshooting Essentials
 -  Windows Server 2008 and Windows Vista : Creating and Using the ADMX Central Store
 -  Windows Server 2008 and Windows Vista : Migrating .adm Templates to ADMX Files