- Documentation
- Client functions
- engineApplyTextureToWorldTexture
Function
engineApplyTextureToWorldTexture
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
engineRemoveTextureFromWorldTextureRemoves a replacement made withengineApplyTextureToWorldTexture(the same texture, pattern and element). The original comes back.engineApplyShaderToWorldTextureReplaces a San Andreas world texture with the given name with the shader's image. The name may contain*and?(e.g."vehiclegrunge*"). Without an element the replacement applies to all objects with that texture, including those loaded later; with an element (vehicle, object, ped) - only to it. The names of textures currently visible in the game are returned byengineGetVisibleTextureNames.