Files
live-wallpaper/samples/test.lua
Diego Lopes 47be135221 Refactor OpenGL bindings and clean up unused functions in lua.cpp and opengl.cpp
Update video texture reference in test.lua and enhance .gitignore for media files
2026-03-21 12:06:16 -04:00

35 lines
853 B
Lua

effect = nil
video = nil
function _create()
video = Texture.FromGStreamer("filesrc location=" .. Resolve("video.mkv"))
local fxSrc = [[uniform sampler2D uTexture;
void main() {
vec2 uv = vUV;
for (int i = 0; i < uNumDisplays; i++) {
vec4 displayNorm = uDisplayNorm[i];
if (vUV.x >= displayNorm.x && vUV.x <= displayNorm.x + displayNorm.z &&
vUV.y >= displayNorm.y && vUV.y <= displayNorm.y + displayNorm.w) {
FragColor = texture(uTexture, GetDisplayUV(uTexture, i));
break;
}
}
}
]]
effect = Effect.new(fxSrc)
end
function _update(dt)
end
function _render()
gl.Clear(0, 0, 0, 1.0)
effect:Use()
effect:SetTexture("uTexture", video, 0)
effect:Render()
end