Created
November 8, 2018 09:07
Star
You must be signed in to star a gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
show_image(source) | |
move_image(source, 0, 0) | |
elseif status.kind == "terminated" then | |
delete_image(source) | |
target_alloc("demo", handler) | |
end | |
end | |
target_alloc("demo", handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment