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

Function

engineApplyTextureToWorldTexture

ClientShadersTrilogy Hub only

Replaces a world texture with a script texture without writing a shader: a texture from dxCreateTexture, a render target, a screen source or a browser is enough. Works like engineApplyShaderToWorldTexture (* and ? patterns, optional element). A render target or browser gives a live image, e.g. an in-game TV showing a web page.

Syntax

bool engineApplyTextureToWorldTexture(element texture, string textureName [, element targetElement = nil])

Arguments

textureelement
A script texture.
textureNamestring
World texture name or pattern.
targetElementelement, optional = nil
A vehicle, object or ped.

Returns

true on success.

Example

local board = dxCreateRenderTarget(512, 256)
engineApplyTextureToWorldTexture(board, "heat_02")
addEventHandler("onClientRender", root, function()
    dxSetRenderTarget(board, true)
    dxDrawRectangle(0, 0, 512, 256, tocolor(0, 0, 0))
    dxDrawText(os.date("%H:%M:%S"), 0, 0, 512, 256, tocolor(255, 255, 0), 4, "default", "center", "center")
    dxSetRenderTarget()
end)

See also