IDirect3DDevice9::DrawRectPatch method (d3d9.h)

Draws a rectangular patch using the currently set streams.

Syntax

HRESULT DrawRectPatch(
  [in] UINT                    Handle,
  [in] const float             *pNumSegs,
  [in] const D3DRECTPATCH_INFO *pRectPatchInfo
);

Parameters

[in] Handle

Type: UINT

Handle to the rectangular patch to draw.

[in] pNumSegs

Type: const float*

Pointer to an array of four floating-point values that identify the number of segments each edge of the rectangle patch should be divided into when tessellated. See D3DRECTPATCH_INFO.

[in] pRectPatchInfo

Type: const D3DRECTPATCH_INFO*

Pointer to a D3DRECTPATCH_INFO structure, describing the rectangular patch to draw.

Return value

Type: HRESULT

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be D3DERR_INVALIDCALL.

Remarks

For static patches: Set the vertex shader, set the appropriate streams, supply patch information in the pRectPatchInfo parameter, and specify a handle so that Direct3D can capture and cache information. Call IDirect3DDevice9::DrawRectPatch subsequently with pRectPatchInfo set to NULL to efficiently draw the patch. When drawing a cached patch, the currently set streams are ignored. Override the cached pNumSegs by specifying a new value for pNumSegs. When rendering a cached patch, you must set the same vertex shader that was set when it was captured.

Calling IDirect3DDevice9::DrawRectPatch with a handle invalidates the same handle cached by a previous IDirect3DDevice9::DrawTriPatch call.

For dynamic patches, the patch data changes for every rendering of the patch, so it is not efficient to cache information. The application can convey this to Direct3D by setting Handle to 0. In this case, Direct3D draws the patch using the currently set streams and the pNumSegs values, and does not cache any information. It is not valid to simultaneously set Handle to 0 and pRectPatchInfo to NULL.

Requirements

Requirement Value
Target Platform Windows
Header d3d9.h (include D3D9.h)
Library D3D9.lib

See also

IDirect3DDevice9

IDirect3DDevice9::DeletePatch

Using Higher-Order Primitives (Direct3D 9)