Platform SDK: DirectX

Direct3DDevice7.DrawPrimitive

The Direct3DDevice7.DrawPrimitive method renders the specified array of vertices as a sequence of geometric primitives of the specified type.

object.DrawPrimitive( _ 
    d3Dpt As CONST_D3DPRIMITIVETYPE, _ 
    d3dfvf As CONST_D3DFVFFLAGS, _ 
    vertices As Any, _ 
    vertexCount As Long, _ 
    flags As CONST_D3DDPFLAGS)

Parameters

object
Object expression that resolves to a Direct3DDevice7 object.
d3Dpt
Type of primitive to be rendered by this command. This must be one of the constants of the CONST_D3DPRIMITIVETYPE enumeration.

Note that the D3DPT_POINTLIST member of CONST_D3DPRIMITIVETYPE is not indexed.

d3dfvf
A combination of flexible vertex format flags from the CONST_D3DFVFFLAGS enumeration that describe the vertex format used.
vertices
First element in an array of vertices to be used in the primitive sequence.
vertexCount
Defines the number of vertices in the vertices array. The maximum number of vertices allowed is 65535 (&HFFFF).
flags
One of the constants of the CONST_D3DDPFLAGS enumeration defining how the primitive is drawn.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

D3DERR_INVALIDRAMPTEXTURE
D3DERR_INVALIDPRIMITIVETYPE
D3DERR_INVALIDVERTEXTYPE
DDERR_WASSTILLDRAWING
DDERR_INVALIDPARAMS

For information on trapping errors, see the Visual Basic Error Trapping topic.

Remarks

This method should not be used when rendering from a vertex buffer, use a vertex buffer method instead.

Make sure that the vertices being rendered match the vertex format you specify. For performance reasons, Direct3D does not attempt to verify that vertex size and stride match the provided flexible vertex format. If a mismatch occurs, a memory fault is likely to result.

See Also

Direct3DDevice7.DrawPrimitiveVB, Direct3DDevice7.DrawIndexedPrimitive, Direct3DDevice7.DrawIndexedPrimitiveVB