Available since LÖVE 0.9.0 |
It has been renamed from PixelEffect:send. |
Sends one or more values to a special (uniform) variable inside the shader. Uniform variables have to be marked using the uniform or extern keyword, e.g.
uniform float time; // "float" is the typical number type used in GLSL shaders. uniform float vars[2]; uniform vec2 light_pos; uniform vec4 colors[4];
The corresponding send calls would be
shader:send("time", t) shader:send("vars",a,b) shader:send("light_pos", {light_x, light_y}) shader:send("colors", {r1, g1, b1, a1}, {r2, g2, b2, a2}, {r3, g3, b3, a3}, {r4, g4, b4, a4})
Uniform / extern variables are read-only in the shader code and remain constant until modified by a Shader:send call. Uniform variables can be accessed in both the Vertex and Pixel components of a shader, as long as the variable is declared in each.
![]() |
There is a bug in version 0.10.2 which causes Shader:send to ignore the last argument when sending arrays. A simple workaround is to add an extra dummy argument when sending multiple values to a uniform array. |
Shader:send( name, number, ... )
string name
number number
number ...
Nothing.
Because all numbers in Lua are floating point, in versions prior to 0.10.2 you must use the function Shader:sendInt to send values to uniform int
variables in the shader's code.
Shader:send( name, vector, ... )
string name
table vector
table ...
Nothing.
Shader:send( name, matrix, ... )
string name
table matrix
{{a,b,c,d}, {e,f,g,h}, ... }
or (since version 0.10.2) {a,b,c,d, e,f,g,h, ...}
. The order in 0.10.2 is column-major; starting in 11.0 it's row-major instead.table ...
Nothing.
Shader:send( name, texture )
string name
Texture texture
Nothing.
Shader:send( name, boolean, ... )
string name
boolean boolean
boolean ...
Nothing.
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Shader:send( name, matrixlayout, matrix, ... )
string name
MatrixLayout matrixlayout
table matrix
{{a,b,c,d}, {e,f,g,h}, ... }
or {a,b,c,d, e,f,g,h, ...}
.table ...
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Sends uniform values to the Shader sourced from the contents of a Data object. This directly copies the bytes of the data.
Shader:send( name, data, offset, size )
string name
Data data
number offset (0)
number size (all)
Nothing.
Available since LÖVE 11.0 |
This variant is not supported in earlier versions. |
Sends uniform matrices to the Shader sourced from the contents of a Data object. This directly copies the bytes of the data.
Shader:send( name, data, matrixlayout, offset, size )
string name
Data data
MatrixLayout matrixlayout
number offset (0)
number size (all)
Nothing.