Partager via


Device.GetRenderTarget(Int32) Method (Microsoft.DirectX.Direct3D)

Retrieves a render target surface.

Definition

Visual Basic Public Function GetRenderTarget( _
    ByVal renderTargetIndex As Integer _
) As Surface
C# public Surface GetRenderTarget(
    int renderTargetIndex
);
C++ public:
SurfaceGetRenderTarget(
    int renderTargetIndex
);
JScript public function GetRenderTarget(
    renderTargetIndex : int
) : Surface;

Parameters

renderTargetIndex System.Int32
Index of the render target. See Remarks.

Return Value

Microsoft.DirectX.Direct3D.Surface
A Surface that represents the returned render target surface for the current device.

Remarks

Typically, methods that return state do not work on devices created using PureDevice. This method, however, is an exception because it returns an interface.

The device can support multiple render targets. The number of render targets supported by a device is contained in the Caps.NumberSimultaneousRts member.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

NotFoundException

No render target is available for the given index.

See Also