Share via


Rendering from a Vertex Buffer (Windows Embedded CE 6.0)

1/6/2010

Rendering vertex data from a vertex buffer requires a few steps. First, you need to set the stream source by calling the IDirect3DMobileDevice::SetStreamSource method, as shown in the following code example.

d3dmDevice->SetStreamSource( 0, g_pVB, sizeof(CUSTOMVERTEX) );

The first parameter of SetStreamSource tells Microsoft® Direct3D Mobile® the source of the device data stream. The second parameter is the vertex buffer to bind to the data stream. The third parameter is the size of the component, in bytes. In the sample code above, the size of a CUSTOMVERTEX is used for the size of the component.

After setting the stream source, any draw methods will use the vertex buffer. The following code example shows how to render vertices from a vertex buffer with the IDirect3DMobileDevice::DrawPrimitive method.

d3dmDevice->DrawPrimitive( D3DMPT_TRIANGLELIST, 0, 1 );

The second parameter that DrawPrimitive accepts is the index of the first vector in the vertex buffer to load.

See Also

Concepts

Using Vertex Buffers