Platform SDK: DirectX

Tutorial 3: Using Alternate Primitive Styles

[Visual Basic]

The information in this section pertains only to applications written in C and C++. See Direct3D Immediate Mode Visual Basic Tutorials.

[C++]

The Using Alternate Primitive Styles tutorial demonstrates how to render polygons using the various draw primitive calls provided by Direct3D. The primitives in this tutorial are polygons, which are closed, three-dimensional (3-D) objects identified by at least three vertices.

Specifically, this tutorial demonstrates how to prepare the geometry for a series of primitives (a series of wall segments, a cone, and a cube); it illustrates how to rotate the viewpoint; and it uses matrix concatenation to perform a 3-D transformation: translating, rotating, and scaling a cube.

For more information on 3-D primitives, see 3-D Primitives.

Note  The code in the DrawPrims application is similar to the code in the Triangle application. This tutorial focuses only on the geometric preparation and rendering code unique to the DrawPrims application, and does not cover setting up Direct3D, shutting down, or processing system events. For information on these tasks, see Tutorial 1: Rendering a Single Triangle.

The Using Alternate Primitive Styles tutorial uses a depth buffer to store depth information for the scene. To use depth buffering, you must enumerate supported depth-buffer formats, create a depth-buffer surface, attach the depth-buffer surface to a render-target surface, and enable depth buffering for the rendering device. For information on these tasks, see Tutorial 2: Adding a Depth Buffer.