DirectX SDK

Tutorial 3: Using Alternate Primitive Styles

[C++]

This section pertains only to application development in Visual Basic. See Direct3D Immediate Mode C/C++ Tutorials.

[Visual Basic]

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

Specifically, this tutorial demonstrates how to prepare the geometry for a series of primitives (a series of wall segments, a cone, and a cube), how to rotate the viewpoint, and how to use 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.