engineCreateTexture
Client
Creates a texture from an image file in the resource or from image bytes in memory. The texture exists on this client only.
texture engineCreateTexture(string source [, string format = "unknown", bool mipmaps = true, string edge = "wrap"])
Parameters
| Name | Type | Description |
|---|---|---|
| source | string | A path to an image file in the resource, or a string holding the image file's bytes. |
| format | string | How the texture is kept: unknown, argb, xrgb, rgb, dxt1, dxt2, dxt3, dxt4 or dxt5. Depth formats are refused.default "unknown" |
| mipmaps | bool | Build mipmaps for the texture.default true |
| edge | string | How it is sampled past its edges: wrap, mirror, clamp, border or mirror-once.default "wrap" |
Returns
The new texture element. Raises an error if the arguments are wrong or the texture could not be made.
The image is decoded in the background. onClientAssetLoad fires on the texture once it is ready, with false if it could not be decoded.
A blank texture is made with engineCreateTexture(width, height [, format, edge, type]): both sides from 1 to 16384 pixels, and type only "2d".
Example
local logo = engineCreateTexture("images/logo.png", "dxt5")
addEventHandler("onClientRender", root, function()
dxDrawImage(20, 20, 128, 128, logo)
end)Coming from MTAThis is MTA's
dxCreateTexture under another name. 3d and cube textures cannot be made.