DxSetShaderValue: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool dxSetShaderValue ( element shader, string parameterName, mixed value )
bool dxSetShaderValue ( element theShader, string parameterName, mixed value )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===  
*'''shader:''' The shader element whose parameter is to be changed
*'''theShader:''' The shader element whose parameter is to be changed
*'''parameterName:''' The name of parameter
*'''parameterName:''' The name of parameter
*'''value:''' The value to set, which can be a [[texture]], a bool, a number or a list of numbers
*'''value:''' The value to set, which can be a [[texture]], a bool, a number or a list of numbers

Revision as of 11:55, 26 January 2013

This sets a named parameter for a shader element

Syntax

bool dxSetShaderValue ( element theShader, string parameterName, mixed value )

Required Arguments

  • theShader: 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 or a list of numbers

Returns

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

Example

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

See Also