- Documentation
- Client functions
- 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
dxDrawImageDraws an image (a resource PNG/JPG file, a texture, a render target, a browser or a camera) in a screen rectangle, with optional rotation and tint.dxGetTexturePixelsReads the pixels of a texture, a render target or a screen source inplain,pngorjpegformat, whole or from a section (x, y, width, height). For example for a screenshot.dxSetTexturePixelsWrites pixels (plain,png,jpeg) into a texture or a render target, whole or into a section.