DirectX SDK

Direct3DDevice7.SetRenderTarget

The Direct3DDevice7.SetRenderTarget method permits the application to easily route rendering output to a new DirectDraw surface as a render target.

object.SetRenderTarget(surface As DirectDrawSurface7)

Parameters

object
Object expression that resolves to a Direct3DDevice7 object.
surface
A DirectDrawSurface7 object for the previously created surface object that will be the new rendering target.

Error Codes

If the method fails, an error is raised and Err.Number may be set one of the following values:

DDERR_INVALIDPARAMS
DDERR_INVALIDSURFACETYPE

For information on trapping errors, see the Visual Basic Error Trapping topic.

Remarks

Capabilities do not change with changes in the properties of the render target surface. Both the Direct3D HAL and the software rasterizers have only one opportunity to expose capabilities to the application. The system cannot expose different sets of capabilities depending on the format of the destination surface.

If a depth-buffer is attached to the new render target, it replaces the previous z-buffer for the context. Otherwise, the old z-buffer is detached and z-buffering is disabled.

If more than one depth-buffer is attached to the render target, this function fails.

See Also

Direct3DDevice7.GetRenderTarget