ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. dxCreateTexture

Function

dxCreateTexture

Creates a texture: from a resource image file, from pixels (plain, png, jpeg, dds) or an empty one of a given size. The texture is a material for dxDrawImage, dxDrawMaterial*3D and shaders.

Syntax

From a file or pixels

element dxCreateTexture(string pathOrPixels [, string format, bool mipmaps, string edge])

Empty

element dxCreateTexture(int width, int height [, string format, string edge])

Arguments

pathOrPixelsstring
A file path or pixels.
edgestring, optional
"wrap", "mirror", "clamp", "border".

Differences from MTA:SA

  • These MTA:SA arguments are not here: bool mipmaps = true, string textureEdge = "wrap"

In MTA:SA

dxCreateTexture(string pixels/filepath, string textureFormat = "argb", bool mipmaps = true, string textureEdge = "wrap")

Returns

The texture or false.

Example

local tex = dxCreateTexture("img/radar.png")
addEventHandler("onClientRender", root, function()
    dxDrawImage(20, 400, 200, 200, tex)
end)

See also