DarkBASIC Professional Help File

DX11 CREATE TEXTURE ARRAY FROM ARRAY

This functions lets you create a texture array from previously loaded / otherwise created images.
All such source images must have the same format and dimensions (this will also be the dimensions and format of the created texture array) and
be stored in a DWORD array passed in as the first parameter to this function.
Take note that the pixel data of the source images will be copied into the created texture array; it is therefore not dependent on the source
images after creation and it may be preferable to delete these after calling this function to create the texture array.
The array may contain blank slots (a value of 0 or nullptr). If this happens, the corresponding image in the texture array will be initialized
to a blank, black, fully transparent image with the format, dimensions and number of mip maps corresponding to the actual images in the array. Take note
however that there should be at least one non-null image in the array, otherwise you're better of using DX11 CREATE TEXTURE ARRAY instead as this lets you
specify the format, dimensions and mip-presence of the created array.
*
Take note that in order to use an image from a texture array for rendering, you will have to write your own shader that makes use of a Texture2DArray resource.
You cannot set a sub-image of a texture array as a "normal" Texture2D texture for an object or sprite.

Syntax

    Return Dword = DX11 CREATE TEXTURE ARRAY FROM ARRAY(images(), [startIndex], [numElements], [accessMode])

Parameters

    images()

> Array
> A DWORD array containing references to the images whose pixel data to use to initialize the texture array. There may be null (zero) slots that will be initialized as blank images.

    [Optional] startIndex

> Dword
> You can optionally use this to start reading from the image array at another position than its beginning. Defaults to 0 for the first element.

    [Optional] numElements

> Dword
> You can also optionally set this to only read a set number of images from the input array. Defaults to zero which will use the entire array.

    [Optional] accessMode

> Dword
> Set to one of the ACCESSMODE_XXX constants. ACCESSMODE_DIRECT_CPUWRITABLE allows faster editing of the image from the CPU (but slower read times by the GPU), ACCESSMODE_GPUWRITABLE is needed to create a images that can be used as read/write resources in a shader.

Returns

The created texture array image.

See also

IMAGE Functions Menu
DX11 Function Categories