Capture the current value of states that are included in a stateblock.
HRESULT Capture();
None.
If the method succeeds, the return value is D3D_OK. If the method fails because capture cannot be done while in record mode, the return value is D3DERR_INVALIDCALL.
Capture captures current values for states within an existing state block. It does not capture the entire state of the device. For example:
HRESULT hr; IDirect3DStateBlock9* pStateBlock = NULL; if(SUCCEEDED(pd3dDevice->CreateStateBlock(D3DSBT_PIXELSTATE, &pStateBlock))) { pd3dDevice->BeginStateBlock(); // Add the ZENABLE state to the stateblock pd3dDevice->SetRenderState ( D3DRS_ZENABLE, true ); pd3dDevice->EndStateBlock ( &pStateBlock ); // Change the current value pd3dDevice->SetRenderState ( D3DRS_ZENABLE, false ); hr = pStateBlock->Capture(); pStateBlock->Release(); }
Creating an empty stateblock and calling Capture does nothing if no states have been set.
Capture will not capture information for lights that are explicitly or implicitly created after the stateblock is created.
Header: Declared in D3d9.h.