aboutsummaryrefslogtreecommitdiff
path: root/bin/main.lua
blob: 9139776515dd5796c11903bd326a0f4f5b9046dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
local shader;
local program = [[
extern Texture img;
extern number dt;
Color effect(Color col, Texture tex, vec2 uv, vec2 screen)
{
	return Texel(img, uv);
	//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