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, ...}
.table ...
Nothing.
Shader:send( name, texture )
string name
Texture texture
Nothing.
Shader:send( name, boolean, ... )
string name
boolean boolean
boolean ...
Nothing.
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/Shader:send