Microsoft DirectX 8.0 (C++)

IDirect3DDevice8::SetStreamSource

Binds a vertex buffer to a device data stream.

HRESULT SetStreamSource(
  UINT StreamNumber,
  IDirect3DVertexBuffer8* pStreamData,
  UINT Stride
);

Parameters

StreamNumber
[in] Specifies the data stream, in the range from 0 to the maximum number of streams - 1.
pStreamData
[in] Pointer to an IDirect3DVertexBuffer8 interface, representing the vertex buffer to bind to the specified data stream.
Stride
[in] Stride of the component, in bytes. See Remarks.

Return Values

If the method succeeds, the return value is D3D_OK.

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

Remarks

This method increments the reference count of the stream being assigned. When the texture is no longer needed, set the texture at the appropriate stage to NULL. If you fail to do this, the surface is not released, resulting in a memory leak.

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

The SetStreamSource method binds a vertex buffer to a device data stream. For details, see Setting the Stream Source.

Requirements

  Header: Declared in D3d8.h.
  Import Library: Use D3d8.lib.

See Also

IDirect3DDevice8::DrawIndexedPrimitive, IDirect3DDevice8::DrawIndexedPrimitiveUP, IDirect3DDevice8::DrawPrimitive, IDirect3DDevice8::DrawPrimitiveUP, IDirect3DDevice8::GetStreamSource