DirectX SDK

Tutorial 1: Rendering a Single Triangle

[C++]

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

[Visual Basic]

To use Direct3D in Visual Basic, you first create a form for your application window, then you create and initialize a series of DirectDraw® and Direct3D related objects. You manipulate these objects through their defined methods, which are also used to initialize subordinate objects required to render a complete scene.

This tutorial illustrates the steps needed to display the simplest possible scene: a single triangle. After helping you set the properties for your main form, the Triangle tutorial details how to properly initialize DirectDraw and Direct3D, including the rendering of the Direct3DDevice object, the lighting, the viewport, the material, and the model's geometry. Then, the tutorial focuses on a pair of subroutines that demonstrate how to render the triangle frame-by-frame, incrementally rotating the triangle about the y-axis.

In the Triangle tutorial, the following steps are used to set up DirectDraw, to set up Direct3D, and to render a scene:

Note  The Visual Basic code in the Triangle tutorial application separates the DirectDraw and Direct3D initialization code from the application specific code; although this is not necessary, it partitions the code into logical, well-defined units.