DirectX SDK |
The IDirect3DDevice7::CaptureStateBlock method updates the values within an existing state block to reflect the current state of the device. The method accepts a single parameter, dwBlockHandle, that identifies the state block which will receive the current state of the device if the call succeeds.
The IDirect3DDevice7::CaptureStateBlock method is especially useful to update a state block that your application has already recorded to include slightly different state settings. To do so, apply the existing state block, change the necessary settings, then capture the state of the system back into the state block. The following pseudo-code illustrates:
// The dwMyBlock variable contains a handle to a device-state block for // a previously-recorded set of device states. // Set the current state block. d3dDevice->ApplyStateBlock(dwMyBlock); // Change device states as needed. . . . // Capture the modified device state data back-into the existing block. d3dDevice->CaptureStateBlock(dwMyBlock);
The CaptureStateBlock method doesn't capture the entire state of the device, it only updates the values for the states already within the state block. For example, imagine a state block that contains the following two operations, represented by psuedo-code:
SetRenderState(D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD); SetTexture(0, lpd3dAnyTexture);
If your application changed either of the preceding two settings since the state block was originally recorded, the IDirect3DDevice7::CaptureStateBlock method will update the states within the block—and only those states—to their new values.
The Direct3DDevice7.CaptureStateBlock method updates the values within an existing state block to reflect the current state of the device. The method accepts a single parameter, blockHandle, that identifies the state block which will receive the current state of the device if the call succeeds.
The Direct3DDevice7.CaptureStateBlock method is especially useful to update a state block that your application has already recorded to include slightly different state settings. To do so, apply the existing state block, change the necessary settings, then capture the state of the system back into the state block. The following pseudo-code illustrates:
' The MyBlock variable contains a handle to a device-state block for ' a previously-recorded set of device states. ' Set the current state block. Call d3dDevice.ApplyStateBlock(MyBlock) ' Change device states as needed. . . . ' Capture the modified device state data back-into the existing block. Call d3dDevice.CaptureStateBlock(MyBlock)
The CaptureStateBlock method doesn't capture the entire state of the device, it only updates the values for the states already within the state block. For example, imagine a state block that contains the following two operations, represented by psuedo-code:
Call SetRenderState(D3DRENDERSTATE_SHADEMODE, D3DSHADE_GOURAUD) Call SetTexture(0, d3dAnyTexture)
If your application changed either of the preceding two settings since the state block was originally recorded, the Direct3DDevice7.CaptureStateBlock method will update the states within the block—and only those states—to their new values.