Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
shader_uniform(3)		  Arcan Lua API 	       shader_uniform(3)

NAME
     shader_uniform - Set values for a uniform values in a specific shader.

SYNOPSIS
     nil
     shader_uniform( shid, symlbl, typestr, vals )

DESCRIPTION
     A shader can have a number of uniform variables declared. The specific val-
     ues of such a uniform can be set through this function. shid is a reference
     to a shader allocated through build_shader. symlbl is the identifier of the
     uniform  and typestr is a string that specifies the actual type of the uni-
     form. Accepted patterns for typestr  include  "b"	(bool),  "i"  (int)  "f"
     (float),  "ff" (vec2), "fff" (vec3), "ffff" (vec4), f*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
     1	    There  is  a  deprecated  version of this function around that has a
	    PERSIST  or NOPERSIST  value placed after typestr . This is now  ig-
	    nored and forced to PERSIST  (keep local copies of uniforms that can
	    survive video layer resets). This has the side-effect that the argu-
	    ment  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:
     shader_ugroup(3) image_shader(3) build_shader(3)

vidsys				   August 2026		       shader_uniform(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=shader_uniform&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help