DarkBASIC Professional Help File

DX11 LOAD IMAGE

Loads the image from the provided file name as a 2D texture.
Supported image formats:

- DDS
- BMP
- PNG
- JPEG
- TIFF
- GIF

.

Syntax

    Return Dword = DX11 LOAD IMAGE(filename, [generateMipMaps], [forceBGRA32], [accessMode])

Parameters

    filename

> String
> The file name to load the image from.

    [Optional] generateMipMaps

> Boolean
> Set to true to generate mip maps for the image. This is appropriate for textures but not for pixel-perfect images (used for sprites etc.). Defaults to true.
> Take note that DDS images can already contain mip maps. If you set this flag to true, or leave it out, any such mip maps will be discarded and new ones auto generated. In other words, if you wish to retain the mip maps from a loaded DDS file you need to set this parameter to false.

    [Optional] forceBGRA32

> Boolean
> Convert the loaded image to the standard 32-bit BGRA format (colours stored as 0xaarrggbb DWORDs). Defaults to false.

    [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 an image that can be used as a read/write resource in a shader.

Returns

The created image.

See also

IMAGE Functions Menu
DX11 Function Categories