Platform SDK: DirectX

Step 2.4: Render the Scene

[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 following IDirect3DDevice7::DrawPrimitive call draws a wall segment composed of a D3DVERTEX-type triangle strip:

    pd3dDevice->DrawPrimitive( D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX,
                               g_pvWall, NUM_WALL_VERTICES, NULL );

The following DrawPrimitive call draws a cone which is a triangle fan of custom, flexible vertices:

    pd3dDevice->DrawPrimitive( D3DPT_TRIANGLEFAN, D3DFVF_XYZ|D3DFVF_NORMAL,
                               g_pvCone, NUM_CONE_VERTICES, NULL );

Lastly, the following IDirect3DDevice7::DrawIndexedPrimitive call draws a cube which is composed of application transformed and lit, indexed vertices:

    pd3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLELIST, D3DFVF_TLVERTEX,
                                      g_pvCube, NUM_CUBE_VERTICES,
                                      g_pwCubeIndices, NUM_CUBE_INDICES, NULL );