Rendering Primitives (Windows CE 5.0)

Send Feedback

This topic introduces the DrawPrimitive rendering methods and provides information about using them in your application.

Vertex Data Streams

The rendering interfaces for Microsoft® Direct3D® Mobile consist of methods that render primitives from vertex data stored in a data buffer. Vertex data consists of vertex elements combined to form vertex components. Vertex elements are the smallest unit of a vertex and represent entities such as position, normal, or color.

Rendering primitives consists of two steps. First, set up the vertex component streams; second, invoke a DrawPrimitive method to render from that stream.

The DrawPrimitive methods specify an offset in the vertex data stream so that an arbitrary contiguous subset of the primitives within one set of vertex data can be rendered with each draw invocation. This enables you to change the device rendering state between groups of primitives that are rendered from the same vertex buffers.

Both indexed and nonindexed drawing methods are supported.

Setting the Stream Source

The IDirect3DMobileDevice::SetStreamSource method binds a vertex buffer to a device data stream, creating an association between the vertex data and the data stream port that feeds the primitive processing functions. The actual references to the stream data do not occur until a drawing method, such as IDirect3DMobileDevice::DrawPrimitive, is called.

A stream is defined as a uniform array of component data, where each component consists of one or more elements representing a single entity such as position, normal, color, and so on. The Stride parameter specifies the size of the component, in bytes.

Rendering from Vertex and Index Buffers

Both indexed and nonindexed drawing methods are supported by Direct3D Mobile. The indexed methods use a single set of indices for all vertex components. Vertex data is presented to the Direct3D Mobile application programming interface (API) in vertex buffers, and index data for the indexed drawing methods is presented in index buffers. For more information, see the following reference topics:

These methods draw primitives from the current set of data input streams. For details on setting the current index array to an index buffer, see the IDirect3DMobileDevice::SetIndices method.

See Also

Rendering

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.