Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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

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

The first parameter of SetStreamSourcetells 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::DrawPrimitivemethod.

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

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

See Also