DirectX SDK

Step 1.3: Prepare the Cube

[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 cube will be represented as an indexed primitive; thus; the cube will be rendered by indexing into an array of vertices. Specifically, the following indices will be used to index into the cube's vertex list during rendering:

    WORD* pwIndex = g_pwCubeIndices;
    *pwIndex++ = 1;  *pwIndex++ = 2;  *pwIndex++ = 3;
    *pwIndex++ = 2;  *pwIndex++ = 1;  *pwIndex++ = 0;
    *pwIndex++ = 4;  *pwIndex++ = 5;  *pwIndex++ = 6;
    *pwIndex++ = 6;  *pwIndex++ = 5;  *pwIndex++ = 7;
    *pwIndex++ = 3;  *pwIndex++ = 2;  *pwIndex++ = 6;
    *pwIndex++ = 3;  *pwIndex++ = 6;  *pwIndex++ = 7;
    *pwIndex++ = 0;  *pwIndex++ = 1;  *pwIndex++ = 4;
    *pwIndex++ = 4;  *pwIndex++ = 1;  *pwIndex++ = 5;
    *pwIndex++ = 2;  *pwIndex++ = 0;  *pwIndex++ = 4;
    *pwIndex++ = 2;  *pwIndex++ = 4;  *pwIndex++ = 6;
    *pwIndex++ = 1;  *pwIndex++ = 3;  *pwIndex++ = 5;
    *pwIndex++ = 5;  *pwIndex++ = 3;  *pwIndex++ = 7;

After defining the geometry for all of your objects in the scene, you can render and display the scene, which is the topic of Step 2: Render and Display the Scene.