Microsoft DirectX 8.1 (Visual Basic)

Direct3DDevice8.DrawPrimitiveUP

Renders data specified by a user memory pointer as a sequence of geometric primitives of the specified type.

object.DrawPrimitiveUP( _ 
    PrimitiveType As CONST_D3DPRIMITIVETYPE, _ 
    PrimitiveCount As Long, _ 
    VertexStreamZeroDataArray As Any, _ 
    VertexStreamZeroStride As Long)

Parts

object
Object expression that resolves to a Direct3DDevice8 object.
PrimitiveType
Member of the CONST_D3DPRIMITIVETYPE enumeration, describing the type of primitive to render.
PrimitiveCount
Number of primitives to render. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the D3DCAPS8 structure.
VertexStreamZeroDataArray
First element of the user memory array containing the vertex data to use for vertex stream zero.
VertexStreamZeroStride
Stride between data for each vertex, in bytes. See Remarks.

Error Codes

If the method fails, an error is raised and Err.Number can be set to D3DERR_INVALIDCALL.

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

This method is intended for use in applications that are unable to store their vertex data in vertex buffers. This method supports only a single vertex stream. The effect of this call is to use the provided vertex data pointer and stride for vertex stream zero. It is invalid to have the declaration of the current vertex shader refer to vertex streams other than stream zero.

The following code fragment shows how to determine VertexStreamZeroStride, using the Visual Basic Len function.

Dim device As Direct3DDevice8
Dim verts(3) As D3DVERTEX

device.DrawPrimitiveUP D3DPT_TRIANGLELIST, 1, verts(0), Len(vert(0))

Note that you pass in only the first element of the array containing the vertex data.

Following any DrawPrimitiveUP call, the stream zero settings, referenced by Direct3DDevice8.GetStreamSource, are set to ByVal 0.

See Also

Direct3DDevice8.DrawIndexedPrimitiveUP, Direct3DDevice8.SetStreamSource, Rendering Primitives