A standalone Tauri v1 + raw WebGL 1 example for editing complete fragment shaders, compiling them live, inspecting diagnostics, controlling shared uniforms, saving shader files, and exporting PNG snapshots.
The editor includes a terminal-style compiler panel below the source. It records:
The preflight inspection recognizes WebGL 2 / GLSL ES 3.00 declarations, out vec4 fragment outputs, texture() calls, ShaderToy mainImage, iTime, iResolution, iMouse, and unsupported #include directives. These messages explain how the pasted source differs from this example’s WebGL 1 / GLSL ES 1.00 contract.
Click any terminal error that includes a line number to select that source line in the editor.
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;
The editor contains a complete fragment shader, including precision, uniforms, helper functions, and main().
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 line diagnostics
A broken edit never blanks the graphics stage. The last successfully linked shader continues rendering until the source compiles again.
| 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 |
Each preset also supplies useful values for the four generic parameters and two color uniforms.
Shader files are read by the WebView file picker, so no native filesystem-read permission is required.
Native permissions are limited to:
Shader text is encoded with TextEncoder and sent through the same binary-write path used by the preceding image export examples.
Snapshots use the current internal canvas resolution and contain only the shader output.
npm install
npm run dev
npm run build
17-tauri-v1-glsl-shader-playground/
├── package.json
├── README.md
├── V1-FOLDER-MAP.md
├── src/
│ ├── index.html
│ ├── styles.css
│ └── app.js
└── src-tauri/
├── Cargo.toml
├── build.rs
├── tauri.conf.json
├── icons/
└── src/
└── main.rs
attribute and varying, not WebGL 2 in and outgl_FragColorUnused uniforms may be optimized out by the shader compiler. The playground safely skips uploads to missing uniform locations.