ShaderSetConstant

Family: 3D · One form

What it does

ShaderSetConstant writes to a 3D object: it sets rather than reads. It takes shaderID (an integer), name (a string), value1 (a float), value2 (a float), value3 (a float) and value4 (a float), and returns nothing. shaderID is the id of a Shader object, the one LoadShader returned: it is how the call knows what to act on.

Syntax

ShaderSetConstant(shaderID integer, name string, value1 float, value2 float, value3 float, value4 float)

Parameters

NameType
shaderIDinteger
namestring
value1float
value2float
value3float
value4float

Every form returns

nothing

Example · generated

shader = LoadShader("assets/data.dat", "assets/data.dat")ShaderSetConstant(shader, "player", 1.0, 1.0, 1.0, 1.0)DO  Sync()LOOP

LoadShader is there to give the call something to act on; ShaderSetConstant is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

286 commands in 3D