Point Lists

A point list is a collection of vertices that are rendered as isolated points. Your application can use them in 3-D scenes for star fields, or dotted lines on the surface of a polygon.

Create a point list by filling an array of vertices, as in the following code fragment:

const DWORD TOTAL_VERTS=6;
D3DVERTEX lpVerts[TOTAL_VERTS];
 
lpVerts[0] = D3DVERTEX(D3DVECTOR(-5,-5,0),D3DVECTOR(0,0,-1),0,0);
lpVerts[1] = D3DVERTEX(D3DVECTOR(0,5,0),D3DVECTOR(0,0,-1),0,0);
lpVerts[2] = D3DVERTEX(D3DVECTOR(5,-5,0),D3DVECTOR(0,0,-1),0,0);
lpVerts[3] = D3DVERTEX(D3DVECTOR(10,5,0),D3DVECTOR(0,0,-1),0,0);
lpVerts[4] = D3DVERTEX(D3DVECTOR(15,-5,0),D3DVECTOR(0,0,-1),0,0);
lpVerts[5] = D3DVERTEX(D3DVECTOR(20,5,0),D3DVECTOR(0,0,-1),0,0);
 

Render the point list using the IDirect3DDevice3::DrawPrimitive method. The following code fragment illustrates the use of IDirect3DDevice3::DrawPrimitive for drawing the point list in the preceding example. All calls to IDirect3DDevice3::DrawPrimitive must occur between IDirect3DDevice3::BeginScene and IDirect3DDevice3::EndScene.

HRESULT hResult;
// This code fragment assumes that lpDirect3DDevice3 is a valid 
// pointer to an IDirect3DDevice3 interface.
hResult = 
    lpDirect3DDevice3->DrawPrimitive(D3DPT_POINTLIST,
                                     D3DFVF_VERTEX,
                                     lpVerts,
                                     TOTAL_VERTS,
                                     D3DDP_WAIT);
 

The following illustration shows the resulting points.

Your application can apply materials and textures to a point list. The colors in the material or texture only appear at the points drawn, and not anywhere between the points.