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

Function

engineApplyShaderToWorldTexture

ClientShadersIdentical to MTA:SA

Replaces 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 by engineGetVisibleTextureNames.

Syntax

bool engineApplyShaderToWorldTexture(element theShader, string textureName [, element targetElement = nil, bool appendLayers = true])

Arguments

theShaderelement
A shader with its texture set.
textureNamestring
Texture name or pattern.
targetElementelement, optional = nil
A vehicle, object or ped.
appendLayersbool, optional = true
For compatibility with existing scripts.

Returns

true on success.

Example

local shader = dxCreateShader("texture gTexture; technique t { pass P0 { Texture[0] = gTexture; } }")
dxSetShaderValue(shader, "gTexture", dxCreateTexture("wrap.png"))
local car = getPedOccupiedVehicle(localPlayer)
if car then engineApplyShaderToWorldTexture(shader, "vehiclegrunge256", car) end

See also