Share via


Device.SetRenderTarget Method

Sets a new color buffer for a device.

Namespace:  Microsoft.WindowsMobile.DirectX.Direct3D
Assembly:  Microsoft.WindowsMobile.DirectX (in Microsoft.WindowsMobile.DirectX.dll)

Syntax

'Declaration
Public Sub SetRenderTarget ( _
    renderTarget As Surface, _
    newZStencil As Surface _
)
'Usage
Dim instance As Device 
Dim renderTarget As Surface 
Dim newZStencil As Surface

instance.SetRenderTarget(renderTarget, _
    newZStencil)
public void SetRenderTarget(
    Surface renderTarget,
    Surface newZStencil
)
public:
void SetRenderTarget(
    Surface^ renderTarget, 
    Surface^ newZStencil
)
public function SetRenderTarget(
    renderTarget : Surface, 
    newZStencil : Surface
)

Parameters

  • newZStencil
    Type: Microsoft.WindowsMobile.DirectX.Direct3D.Surface

    A new color buffer Surface. If set to nulla null reference (Nothing in Visual Basic), the color buffer for the corresponding renderTarget is disabled. Devices must always be associated with a color buffer.

    The new render-target surface must have at least Usage specified.

Exceptions

Exception Condition
InvalidCallException

The method call is invalid. Either renderTarget is null and newZStencil = 0, or renderTarget is not null and the render target is invalid.

Remarks

The device can support multiple render targets. Some hardware tests the compatibility of the depth stencil buffer with the color buffer. If this is done, it is done only in a debug build. The following restrictions apply when using this method:

  • The MultiSampleType type must be the same for the render target and the depth stencil surface.

  • The formats must be compatible for the render target and the depth stencil surface. For more information, see CheckDepthStencilMatch.

  • The size of the depth stencil surface must be greater than or equal to the size of the render target.

These restrictions are validated only when using the debug runtime when any of the Device drawing methods are called.

.NET Framework Security

Platforms

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5, 2.0

See Also

Reference

Device Class

Device Members

Microsoft.WindowsMobile.DirectX.Direct3D Namespace