DarkBASIC Professional Help File

DX11 CREATE RENDER TARGET

Creates an image that can be used as a render target by cameras.
Use SET CAMERA RENDER TARGET to set a normal render target, and SET CAMERA DEPTH STENCIL BUFFER to set a depth/stencil buffer.
Depth/stencil buffers are render target images that use the D??S?? formats (see DX11Includes.dba for a full list of available pixel formats), which means that this
function can also be used to create such depth/stencil buffers.
This function can also create arrays of render targets; these can then be used as texture arrays. By setting the number of array slices to a negative multiple of 6, the render
targets will be created as a cubemap / a cubemap array (if < -6). Take note that cubemap arrays are only supported by DXVERSION_10_1 and above (ie. not DXVERSION_10_0) though!

Syntax

    Return Dword = DX11 CREATE RENDER TARGET(width, height, [format], [arraySize], [makeDepthStencilBuffer])

Parameters

    width

> Dword
> The width of the render target, in pixels (all images will have this width if an array / cubemap is created).

    height

> Dword
> The height of the render target, in pixels (all images will have this height if an array / cubemap is created).

    [Optional] format

> Dword
> The format of the created images. Corresponds directly to the DXGI_FORMAT enumeration that you can find on MSDN. Defaults to B8G8R8A8 which is the default used by DBPro as well.

    [Optional] arraySize

> Integer
> Set to one to only create a single image, or a value > 1 to create a render target array. If set to a negative multiple of 6, a cubemap (array) will be created where each face is a render target. Defaults to 1, meaning only a single render target image is created.

    [Optional] makeDepthStencilBuffer

> Boolean
> Set to true to create a depth stencil buffer instead of a normal render target. If so, the format parameter must be set to one of the DXGI_FORMAT_D??S?? formats. Defaults to false, which will create a normal render target image.

Returns

The created render target image / depth stencil buffer, or nullptr (0) if it could not be created. This can for example happen if you specify a depth stencil format but don't set the makeDepthStencilBuffer flag to true.

See also

IMAGE Functions Menu
DX11 Function Categories