Microsoft DirectX 9.0

IDirect3DDevice9::GetRenderTarget Method

Retrieves a render target surface.


HRESULT GetRenderTarget(      

    DWORD RenderTargetIndex,     IDirect3DSurface9 **ppRenderTarget );


[in] Index of the render target. See Remarks.
[out] Address of a pointer to an IDirect3DSurface9 interface, representing the returned render target surface for this device.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be D3DERR_INVALIDCALL if one of the arguments is invalid, or D3DERR_NOTFOUND if there's no render target available for the given index.


The device can now support multiple render targets. The number of render targets supported by a device is contained in the NumSimultaneousRTs member of D3DCAPS9. See Multiple Render Target.

Calling this method will increase the internal reference count on the IDirect3DSurface9 interface. Failure to call IUnknown::Release when finished using the IDirect3DSurface9 interface results in a memory leak.

See Also


© 2002 Microsoft Corporation. All rights reserved.