Device.CreateRenderTarget Method

Language:

Creates a render target surface.

Definition

Visual Basic Public Function CreateRenderTarget( _
    ByVal width As Integer, _
    ByVal height As Integer, _
    ByVal format As Format, _
    ByVal multiSample As MultiSampleType, _
    ByVal multiSampleQuality As Integer, _
    ByVal lockable As Boolean _
) As Surface
C# public Surface CreateRenderTarget(
    int width,
    int height,
    Format format,
    MultiSampleType multiSample,
    int multiSampleQuality,
    bool lockable
);
C++ public:
SurfaceCreateRenderTarget(
    int width,
    int height,
    Format format,
    MultiSampleType multiSample,
    int multiSampleQuality,
    bool lockable
);
JScript public function CreateRenderTarget(
    width : int,
    height : int,
    format : Format,
    multiSample : MultiSampleType,
    multiSampleQuality : int,
    lockable : boolean
) : Surface;

Parameters

width System.Int32
Width of the render-target surface in pixels.
height System.Int32
Height of the render-target surface in pixels.
format Microsoft.DirectX.Direct3D.Format
Member of the Format enumerated type that describes the format of the render target.
multiSample Microsoft.DirectX.Direct3D.MultiSampleType
Member of the MultiSampleType enumerated type that describes the multisampling buffer type. This parameter specifies the antialiasing type for the render target. When this surface is passed to Device.SetRenderTarget, its multisample type must be the same as that of the depth stencil property Device.DepthStencilSurface.
multiSampleQuality System.Int32
Quality level. The valid range is between 0 and one less than the level returned by the param_Int32R_qualityLevels parameter of the Manager.CheckDeviceMultiSampleType. Passing a larger value causes an InvalidCallException. The param_Int32_multiSampleQuality values of paired render targets, depth stencil surfaces, and the multisample type must all match.
lockable System.Boolean
Set to true if render targets are lockable; otherwise, false. Note that lockable render targets reduce performance on some graphics hardware.

Return Value

Microsoft.DirectX.Direct3D.Surface
A Surface.

Remarks

Render-target surfaces are placed in the Pool memory class.

The creation of lockable, multisampled render targets is not supported.

Exceptions
NotAvailableException The device does not support the queried multisample type.
InvalidCallException The method call is invalid. For example, a parameter might contain an invalid value.
OutOfVideoMemoryException Microsoft Direct3D does not have enough display memory to perform the operation.
OutOfMemoryException Leave Site Direct3D could not allocate sufficient memory to complete the call.


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center