image_shader(3)

πŸ“¦
version 0.7.1 Β· 2 versions
, in nixos 26.05

πŸ’… image_shader(3) β€” like, the Arcan Lua API one, bestie ✨

okay so this page lives in section 3 of the manual and it's all about image_shader β€” setting the active shader for an object. literally that's the whole vibe. let's get into it 🫢


✨ NAME ✨

image_shader β€” set the active shader for an object. that's it, that's the job, and it ate πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

oldshid
image_shader( vid:image, string:identifier )
image_shader( vid:image, integer:identifier )
image_shader( vid:image, string:identifier, integer:attributes )
image_shader( vid:image, integer:identifier, integer:attributes )

so there's four ways to call her, and yes oldshid is just sitting up there on its own line, iconic behavior, love that for her 🌸


πŸŽ€ DESCRIPTION πŸŽ€

okay so processing programs can be created using the build_shader call, right? and then β€” plot twist β€” those programs can get assigned to an image through this function. main character energy honestly πŸ‘‘

if attributes are provided, the value is expected to be one of these constants:

  • SHADER_DOMAIN_RENDERTARGET β€” find a rendertarget bound to image and assign the shader as the default program for objects using this rendertarget. if image does not contain a rendertarget, it is a terminal state transition. yes, terminal. it's giving final boss πŸ’€
  • SHADER_DOMAIN_RENDERTARGET_HARD β€” same as for SHADER_DOMAIN_RENDERTARGET, except all shaders on objects attached to the rendertarget will be ignored. this is useful for a temporary suspension of all shaders, as well as for rendertargets created using define_linktarget. no cap, this is the "everybody chill for a sec" mode πŸ™ˆ

πŸ’– NOTES πŸ’–

  1. if only the vid is provided, the active program won't be changed, and the function is then used to query the active program of a video object. so, like, she's just reading the room, not touching anything 🧚
  2. if a string argument is supplied as the second argument, the routine will first resolve it by looking for a previously compiled shader with a name that matches the argument. name match, periodt ⭐
  3. the shader state of all video objects are set to ' DEFAULT ' which is some platform default safe sate that follows obj_opacity and normal texturing. (yes, the original says "sate", we're keeping her exactly as she is, she's doing great 😭)
ngl note 3 is the one you wanna tattoo on your brain β€” the default state is a safe state, so nothing's out here doing unhinged things before you touch it ✨

🌈 EXAMPLE 🌈

function image_shader0()
      shid = build_shader(nil, [[
            void image_shader0(){
                  gl_FragColor = vec4(0.5, 1.0, 0.5, 1.0);
            }
      ]], "demoshader");
      a = fill_surface(64, 64, 0, 0, 0);
      show_image(a);
      image_shader(a, shid);
end

look at her go β€” build the shader, make a 64 by 64 surface, show it, slap the shader on it. the whole pipeline in five lines, we love a concise queen πŸ’…πŸ’–


πŸ”₯ SEE ALSO πŸ”₯

go read those next, iykyk, they're the friend group 🫢


and that's the page bestie!! 🌸 this whole thing came from the image manual, dated October 2026, and yeah she's stamped image_shader(3) at the bottom too because consistency is a lifestyle πŸ’œβœ¨

πŸ“¦ where this page comes from