shader_uniform(3)
π shader_uniform(3) β Arcan Lua API β¨
πΈ NAME πΈ
shader_uniform β Set values for a uniform values in a specific shader. π«Ά
π SYNOPSIS π
nil
shader_uniform( shid, symlbl, typestr, vals )
β¨ DESCRIPTION β¨
Okay bestie, so a shader can have a number of uniform variables declared, right? The specific values of such a uniform can be set through this function. π
shidis a reference to a shader allocated throughbuild_shader.symlblis the identifier of the uniform.typestris a string that specifies the actual type of the uniform.
Accepted patterns for typestr include:
"b"β bool"i"β int"f"β float"ff"β vec2"fff"β vec3"ffff"β vec4f*16β mat4
It is also possible for one shaderid to maintain different sets of uniform values. Each group is tied to the life-cycle of the program and is allocated with shader_ugroup. The id that is returned can then be used in image_shader to specify which subgroup that is to be used. π
π NOTES π
- There is a deprecated version of this function around that has a
PERSISTorNOPERSISTvalue placed aftertypestr. This is now ignored and forced toPERSIST(keep local copies of uniforms that can survive video layer resets). This has the side-effect that the argument validation is less aggressive and may permit a mismatch of up to one argument. β οΈ
π§ EXAMPLE π§
function shader_uniform0()
local shid = build_shader(nil, [[ uniform float vec3 col;
void shader_uniform0(){
gl_FragColor = vec4(col, 1.0);
}]], "csh");
a = fill_surface(128, 128, 0, 0, 0);
show_image(a);
image_shader(a, shid);
shader_uniform(shid, "col", "fff", PERSIST, 0.0, 1.0, 0.0);
end
π SEE ALSO π
xoxo, vidsys π October 2026 β shader_uniform(3) out, periodt π
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms