Microsoft DirectX 9.0

IDirect3DDevice9::SetStreamSource Method

Binds a vertex buffer to a device data stream. For more information, see Setting the Stream Source.


HRESULT SetStreamSource(      

    UINT StreamNumber,     IDirect3DVertexBuffer9 *pStreamData,     UINT OffsetInBytes,     UINT Stride );


[in] Specifies the data stream, in the range from 0 to the maximum number of streams -1.
[in] Pointer to an IDirect3DVertexBuffer9 interface, representing the vertex buffer to bind to the specified data stream.
[in] Offset from the beginning of the stream to the beginning of the vertex data, in bytes. To find out if the device supports stream offsets, see the D3DDEVCAPS2_STREAMOFFSET constant in D3DDEVCAPS2.
[in] Stride of the component, in bytes. See Remarks.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be D3DERR_INVALIDCALL.


When a flexible vertex format (FVF) vertex shader is used, the stride of the vertex stream must match the vertex size, computed from the FVF. When a declaration is used, the stride should be greater than or equal to the stream size computed from the declaration.

When an application no longer holds a references to this interface, the interface will automatically be freed.

See Also

IDirect3DDevice9::GetStreamSource, IDirect3DDevice9::DrawIndexedPrimitive, IDirect3DDevice9::DrawIndexedPrimitiveUP, IDirect3DDevice9::DrawPrimitive, IDirect3DDevice9::DrawPrimitiveUP

© 2002 Microsoft Corporation. All rights reserved.