?/TD>
Microsoft DirectX 9.0

IDirect3DDevice9::DrawTriPatch Method


Draws a triangular patch using the currently set streams.

Syntax

HRESULT DrawTriPatch(      

    UINT Handle,     const float* pNumSegs,     const D3DTRIPATCH_INFO* pTriPatchInfo );

Parameters

Handle
[in] Handle to the triangular patch to draw.
pNumSegs
[in] Pointer to an array of three floating-point values that identify the number of segments each edge of the triangle patch should be divided into when tessellated. See D3DTRIPATCH_INFO.
pTriPatchInfo
[in] Pointer to a D3DTRIPATCH_INFO structure, describing the triangular high-order patch to draw.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.


Remarks

For static patches: Set the vertex shader, set the appropriate streams, supply patch information in the pTriPatchInfo parameter, and specify a handle so that Microsoft?Direct3D?can capture and cache information. To efficiently draw the patch, call IDirect3DDevice9::DrawTriPatch with pTriPatchInfo set to NULL. 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::DrawTriPatch with a handle invalidates the same handle cached by a previous IDirect3DDevice9::DrawRectPatch 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 pTriPatchInfo to NULL.

See Also

Using Higher-Order Primitives


© 2002 Microsoft Corporation. All rights reserved.