Binds a vertex buffer to a device data stream. For more information, see Setting the Stream Source (Direct3D 9).
HRESULT SetStreamSource( [in] UINT StreamNumber, [in] IDirect3DVertexBuffer9 *pStreamData, [in] UINT OffsetInBytes, [in] UINT Stride );
- StreamNumber [in]
Specifies the data stream, in the range from 0 to the maximum number of streams -1.
- pStreamData [in]
Pointer to an IDirect3DVertexBuffer9 interface, representing the vertex buffer to bind to the specified data stream.
- OffsetInBytes [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.
- Stride [in]
Stride of the component, in bytes. See Remarks.
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.
When a 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 calling SetStreamSource, the stride is normally required to be equal to the vertex size. However, there are times when you may want to draw multiple instances of the same or similar geometry (such as when using instancing to draw). For this case, use a zero stride to tell the runtime not to increment the vertex buffer offset (ie: use the same vertex data for all instances). For more information about instancing, see Efficiently Drawing Multiple Instances of Geometry (Direct3D 9).
- Vertex Buffers (Direct3D 9)