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

Function

dxSetShaderValue

ClientShadersIdentical to MTA:SA

Sets a shader parameter. When the parameter is a texture declared in the .fx code (or the shader has none) and the value is a texture (dxCreateTexture, render target, browser) or an image path, that image becomes the new texture swapped into the world. Numbers and vectors are stored for compatibility with existing scripts.

Syntax

bool dxSetShaderValue(element theShader, string parameterName, any value [, float ...])

Arguments

theShaderelement
The shader.
parameterNamestring
Parameter name from the .fx code.
valueany
A texture, image path, number or table of numbers.
...float, optional
Further vector numbers.

Returns

true on success, false for an unknown material.

Example

local shader = dxCreateShader("texture gTexture; technique t { pass P0 { Texture[0] = gTexture; } }")
local target = dxCreateRenderTarget(512, 256)
dxSetShaderValue(shader, "gTexture", target)
engineApplyShaderToWorldTexture(shader, "heat_02")

See also