Microsoft DirectX 8.1 (Visual Basic) |
Sets a new color buffer, depth buffer, or both for the device.
object.SetRenderTarget( _ NewRenderTarget As Direct3DSurface8, _ NewDepthStencil As Direct3DSurface8, _ Reserved )
The new render target surface must have at least D3DUSAGE_RENDERTARGET specified.
The new depth-stencil surface must have at least D3DUSAGE_DEPTHSTENCIL and D3DPOOL_DEFAULT specified.
If the method fails, an error is raised and Err.Number may be set to D3DERR_INVALIDCALL if NewRenderTarget or NewDepthStencil are not Nothing and invalid, or if the new depth buffer is smaller than the new or retained color buffer.
For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.
Once a color buffer and a depth-stencil surface have been associated with the same device by this method, they are said to be paired.
The previous depth-stencil surface's contents persist after a call to SetRenderTarget to disassociate the previous depth-stencil surface from the device. If the surface is re-associated with the device, then the contents of the surface will be unchanged, providing the color buffer to which the new depth-stencil surface is being paired is the same size and format as the color buffer to which the depth-stencil surface was most recently paired.
Direct3DDevice8.CreateDepthStencilSurface, Direct3DDevice8.GetDepthStencilSurface