From ea88790b539f80e1d41bba268136d78357aa87d1 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 5 Sep 2018 22:40:20 +0800 Subject: *update --- bin/main.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 bin/main.lua (limited to 'bin/main.lua') diff --git a/bin/main.lua b/bin/main.lua new file mode 100644 index 0000000..89a8c01 --- /dev/null +++ b/bin/main.lua @@ -0,0 +1,33 @@ +local shader; +local program = [[ +extern Texture img; +extern number dt; +Color effect(Color col, Texture tex, vec2 uv, vec2 screen) +{ + //return vec4(1, 0, 1, 1); + return sin(dt)*Texel(tex, uv) * Texel(img, uv); +} +]] +local img +local img2 +function jin.core.onLoad() + shader = jin.graphics.newShader(program) + img = jin.graphics.newTexture("img.png") + img2 = jin.graphics.newTexture("img2.bmp") +end + +function jin.core.onEvent(e) + if e.type == "quit" then + jin.core.stop() + end +end + +local dt = 0 +function jin.core.onDraw() + dt = dt + 0.1 + jin.graphics.useShader(shader) + shader:sendTexture("img", img2) + shader:sendNumber("dt", dt) + jin.graphics.draw(img, 0, 0) + jin.graphics.unuseShader() +end \ No newline at end of file -- cgit v1.1-26-g67d0