Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
with the following code available in the 'resource' namespace
(i.e. what you set with the -p argument, like:
arcan -p $HOME -H my_scripts/appl_hook.lua console
in $HOME/my_scripts/appl_hook.lua:
local grey = [[
uniform sampler2D map_tu0;
uniform float obj_opacity;
varying vec2 texco;
void main()
uniform sampler2D(map_tu0, texco).rgb;
float luma = 0.2126 * col.r + 0.7152 * col.g + 0.0722 * col.b;
gl_FragColor = vec4(luma, luma, luma, obj_opacity);
local shid = build_shader(nil, grey, "GREYSCALE")
local handler
handler = function(source, status)
if status.kind == "resized" then
resize_image(source, status.width, status.height)
image_shader(source, shid)
move_image(source, 0, 0)
elseif status.kind == "terminated" then
target_alloc("demo", handler)
target_alloc("demo", handler)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment