glsl-view
a minimal GLSL shader host with an OSC interface for setting uniforms in realtime.
OSC interface
GLSL uniforms are accessible as /$UNIFORM_NAME
. The OSC type must match the GLSL type:
uniform float time = 0;
uniform dvec3 color;
----
/time f 123.56
/color ddd 0.5 0.1 0.1
Vectors and matrices can be indexed using integers or the GLSL swizzling keys (x/y/z/w, r/g/b/a, s/t/p/q):
uniform vec3 color;
uniform mat3 mat;
----
/color/r f 0.5
/mat/0/y f 123
samplers
When built with ffmpeg, images and videos can be loaded as 2D or 3D textures:
uniform sampler2D image;
uniform sampler3D videoA;
uniform sampler2DArray videoB;
----
/image s "image.jpg"
/videoA s "subdir/video_a.mp4"
/videoB s "subdir/video_b.mov"
The filepaths are interpreted relative to the config file.
video files
Videos are fully uploaded to the GPU as 2D-array- or 3D textures. To save on GPU memory, textures are stored using GPU compression. Nevertheless, the resolution and length are limited.
Loading most video formats is quite slow because the frames need to be compressed during upload. Videos encoded using HAP or HAP Alpha will load much faster since the image data is already in the GPU compressed format.
commands
A message to /-/reload
forces a reload of the shader source code.
configuration
Configuration is read from config.yaml
or the only command line argument.
fragment
(str
): path to GLSL fragment shader.width
(int
): horizontal rendering resolution. defaults to1920
.height
(int
): vertical rendering resolution. defaults to1080
.outputs
: list of outputs. defaults to one 800x600 window. each output is a dictionary with the following keys:type
(str
): currently alwayswindow
.width
(int
): window width. defaults to800
.height
(int
): window height. defaults to600
.filter
(str
): one ofnearest
orlinear
.osc
: either a 'liblo URL' or dictionary with the following keys:protocol
(str
):udp
,tcp
orunix
. defaults toudp
.port
(int
): port to bind to. defaults to9000
.
liblo URLs
Unfortunately undocumented by libio. The following formats are valid:
osc.udp://localhost:1234
osc.udp://224.0.1.9:1234
(multicast IP)osc.tcp://:1234
osc.unix://localhost/tmp/mysocket
Commit History
@main
git clone https://git.s-ol.nu/glsl-view.git
- texture-share-vk output support s-ol 2 days ago
- fix conditional compilation s-ol 3 days ago
- update for Zig 0.14.0 s-ol 3 days ago
- implement HAP decoding straight to compressed GPU texture s-ol 3 days ago
- Update README.md s-ol 7 days ago
- allow disabling texture/ffmpeg support at build time s-ol 7 days ago
- fix shader reloading wrt Textures s-ol 8 days ago
- load videoes/textures relative to project_root s-ol 8 days ago
- automatically add GLSL 3.30 header s-ol 17 days ago
- configurable filter for output scaling s-ol 17 days ago