DxSetShaderValue

From Multi Theft Auto: Wiki
Revision as of 16:02, 11 June 2011 by Ccw (talk | contribs) (Created page with "{{Client function}} __NOTOC__ {{New feature|3.0110|1.1| Only available in 1.1 }} This sets a named parameter for a shader element ==Syntax== <syntaxhighlight lang="lua"> bool shaderSetVal...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Only available in 1.1 This sets a named parameter for a shader element

Syntax

bool shaderSetValue ( element shader, string parameterName, mixed value )

Required Arguments

  • shader: The shader element whose parameter is to be changed
  • parameterName: The name of parameter
  • value: The value to set, which can be a texture, a bool, a number, a table of numbers or a list of numbers

Returns

Returns true if the shader element's parameter was successfully changed, false otherwise.

Example

myShader = createShader( "hello.fx" )
myTexture = createTexture( "man.png" )
setShaderValue( myShader, "texure0", myTexture )                -- Set a texture
setShaderValue( myShader, "bShowThing", true )                  -- Set a bool                  
setShaderValue( myShader, "speed", 2.4 )                        -- Set a number
setShaderValue( myShader, "positionOfCheese", 100, 200, 300 )   -- Set a list of numbers

See Also