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 void SetRenderTarget (
    Surface renderTarget, 
    Surface newZStencil
)
public function SetRenderTarget (
    renderTarget : Surface, 
    newZStencil : Surface
)

Parameters

  • renderTarget
    An index Surface of the render target.
  • newZStencil
    A new color buffer Surface. If set to a 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 type Condition

InvalidCallException

The method call is invalid. Either renderTarget is a null reference (Nothing in Visual Basic)and newZStencil = 0, or renderTarget is not a null reference (Nothing in Visual Basic)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

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Platforms

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

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

Version Information

.NET Compact Framework

Supported in: 2.0

See Also

Reference

Device Class
Device Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace