Microsoft DirectX 8.0 (C++) |
The following sample shows how an application would render a technique. After finding a valid technique the application can call the ID3DXTechnique::Begin method to start the application of the technique as shown in the code example below.
UINT uPasses; pTechnique->Begin(&uPasses);
The only parameter that Begin accepts is the address of a unsigned integer. After Begin is called, this integer will contain the number of passes used for the technique.
The next step is to render each pass individually. To render a pass, call the ID3DXTechnique::Pass method. The code example below uses a loop to render all the passes required for a technique.
for(UINT uPass = 0; uPass < uPasses; uPass++) { pTechnique->Pass(uPass); g_d3dDevice->SetStreamSource( 0, pvbVertices, sizeof(WATER_VERTEX) ); g_d3dDevice->SetIndices( pIB, 0 ); g_d3dDevice->DrawIndexedPrimitive( D3DPT_TRIANGLESTRIP, 0, uVertices, 0, uIndices -2 ); }
The call to Pass sets up the necessary states to render the scene.
Note The call to ID3DXTechnique::Begin must be inside a IDirect3DDevice8::BeginScene / IDirect3DDevice8::EndScene block.