Microsoft DirectX 8.1 (Visual Basic) |
The Direct3DDevice8.CaptureStateBlock method updates the values in an existing state block to reflect the current state of the device. The method accepts a single parameter, Token, that identifies the state block that will receive the current state of the device if the call succeeds.
The 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 to the state block, as shown in the following code example.
' The Token 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(Token) ' Change device states as needed. . . . ' Capture the modified device state data back to the existing block. Call d3dDevice.CaptureStateBlock(Token)
The CaptureStateBlock method doesn't capture the entire state of the device; it only updates the values for the states already in the state block. For example, imagine a state block that contains the two operations shown in the following code example.
Call d3dDevice.SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD) Call d3dDevice.SetTexture(0, Texture)
If your application changed either of these settings since the state block was originally recorded, the CaptureStateBlock method will update the states within the block—and only those states—to their new values.