A standalone Tauri v2 + raw WebGL 1 example for editing complete fragment shaders, compiling them live, inspecting a terminal-style diagnostic stream, controlling shared uniforms, loading/saving shader files through native dialogs, and exporting PNG snapshots.
The terminal records:
The preflight inspection recognizes:
#version 300 esout vec4 fragment outputstexture() instead of WebGL 1 texture2D()mainImage()iTime, iResolution, and iMouselayout(...) qualifiers#include directivesvoid main()A .frag or .glsl extension does not determine shader compatibility. The terminal explains the actual GLSL dialect or contract mismatch.
Every fragment shader receives:
precision highp float;
varying vec2 v_uv;
uniform float u_time;
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform vec3 u_color_a;
uniform vec3 u_color_b;
uniform float u_param0;
uniform float u_param1;
uniform float u_param2;
uniform float u_param3;
Editor source
│
├── automatic: 650 ms debounce
└── manual: Compile / Cmd+Enter / Ctrl+Enter
│
▼
compile + link
│
┌──────────┴──────────┐
│ │
success failure
│ │
replace active retain previous
GPU program valid program
│ │
▼ ▼
preview terminal diagnostics
| Preset | Technique |
|---|---|
| Domain warp | Layered value noise and fractional Brownian motion |
| Orbital rings | Polar coordinates, repetition, and radial glow |
| Cellular field | Animated nearest-point / Voronoi-style distances |
| Spectral plasma | Interfering sine fields and spectral color mixing |
| Minimal gradient | Small readable starter shader |
Native open / OS file drop
│
▼
Rust read_shader_file command
│ UTF-8 source string
▼
Editor → compile terminal → WebGL
Browser file input remains available as a fallback. Native and dropped shader files are limited to .frag, .glsl, .fs, and .txt, with an 8 MiB source safety limit.
Native permissions are limited to core IPC and open/save dialogs. The Rust backend exposes:
read_shader_filewrite_binarytoggle_fullscreennpm install
npm run dev
npm run build
17-tauri-v2-glsl-shader-playground/
├── package.json
├── README.md
├── V2-FOLDER-MAP.md
├── src/
│ ├── index.html
│ ├── styles.css
│ └── app.js
└── src-tauri/
├── Cargo.toml
├── build.rs
├── tauri.conf.json
├── capabilities/
│ └── default.json
├── icons/
└── src/
└── main.rs
attribute and varying, not WebGL 2 in and outgl_FragColorUnused uniforms may be optimized out. The playground safely skips uploads to missing uniform locations.