p5.js Shader · Single Window
p5-tauri-single-template
p5.js WebGL shader baseline with controls and renderer in one WebView.
Developer documentation · July 2026 baseline
The first sections get a new developer running quickly. Later sections explain render ownership, media flow, GPU resources, state recovery, modernization lessons, and how the completed baselines inform Scheng and future standalone instruments.
Junkpile is a developer library of small, inspectable desktop applications for creative graphics and live media. Each project isolates one architecture so it can be run, traced, modified, packaged, and reused without inheriting a hidden monolith.
Accessible browser rendering and native bridges using Tauri 1.
Modern capabilities, window APIs, file workflows, and WebGL applications.
Rust-owned GPU surfaces, WGSL, compute, 3D, media bridges, and export.
npm install, then npm run dev. This selects the correct Tauri CLI major.npm run build. On macOS, bundles are normally written beneath src-tauri/target/release/bundle.cd <collection>/<example-folder>
npm install
npm run dev
npm run buildEach Junkpile example is an independent Tauri application. Install the platform prerequisites once, then run commands from the individual example folder you want to use.
| Tool | Purpose | Verify |
|---|---|---|
| Node.js and npm | Frontend dependencies and local project scripts | node --versionnpm --version |
| Rust and Cargo | Tauri backend and native wgpu projects | rustc --versioncargo --version |
| Git | Clone and update the repository | git --version |
| System build tools | Compile native application dependencies | See the platform steps below |
xcode-select --installMetal is provided by macOS. Camera and microphone examples request permission when launched.
Install Microsoft Visual Studio Build Tools with the Desktop development with C++ workload. Install or update the WebView2 Runtime. A Direct3D 12-capable driver is recommended for native wgpu examples.
Install the Tauri WebKitGTK development packages required by your distribution. Native wgpu examples also require a working Vulkan or supported GL driver. MIDI examples commonly require ALSA development packages.
git clone https://github.com/schwwaaa/junkpile.git
cd junkpileYou can also download the repository ZIP from GitHub and extract it locally.
Open the example catalog, copy the project folder name, and enter that folder. Do not run installation commands from the repository root unless a root script explicitly says to do so.
cd v1/<example-folder>cd v2/<example-folder>cd native-wgpu/<example-folder>npm install
npm run devThe first launch may take several minutes because Cargo downloads and compiles Rust dependencies. Later launches are substantially faster.
npm run buildProduction bundles are normally created beneath:
src-tauri/target/release/bundle/| Platform | Typical output |
|---|---|
| macOS | bundle/macos/*.app and, when configured, bundle/dmg/*.dmg |
| Windows | bundle/msi/*.msi or bundle/nsis/*.exe |
| Linux | bundle/appimage/*.AppImage, Debian package, or another configured bundle target |
| Need | Best starting track | Reason |
|---|---|---|
| p5.js, familiar browser APIs, rapid sketch-to-app work | Tauri v1 or v2 WebView | The renderer stays in HTML/JavaScript with GLSL ES. |
| Current Tauri permissions, native dialogs/drop, multi-window production examples | Tauri v2 WebView | Uses Tauri 2 capabilities and current WebView-window APIs. |
| Compute shaders, native GPU resources, 3D, Metal/Vulkan/DX12, 4K–8K export | Native wgpu | Rust owns the surface, device, queue, textures, buffers, and WGSL pipelines. |
| Compare architectural generations | Examples 00–09 across v1 and v2 | The paired lessons reveal version changes without changing the core visual concept. |
| Build a focused media application | Examples 12–25, then native-wgpu equivalents | These examples cover playback, analysis, recording, compositing, automation, routing, and output. |
The three Junkpile paths solve different layers of the same problem. They are not ranked from beginner to advanced. Each one defines who owns the renderer, where GPU resources live, how media crosses boundaries, and what kind of standalone application is easiest to build.
| Technical concern | Tauri v1 WebView | Tauri v2 WebView | Native Rust/wgpu |
|---|---|---|---|
| Render ownership | Browser/WebView owns the drawing surface and render loop. | Browser/WebView owns the drawing surface and render loop, with newer Tauri window/capability APIs around it. | Rust owns the surface, device, queue, textures, buffers, passes, and present loop. |
| Primary graphics stack | HTML/CSS/JS + p5.js/WebGL. | HTML/CSS/JS + p5.js/WebGL or raw WebGL with current Tauri 2 APIs. | Rust + wgpu + WGSL, optional compute passes, explicit render graph structure. |
| Shader language | GLSL / GLSL ES inside WebGL. | GLSL / GLSL ES inside WebGL. | WGSL for render and compute pipelines. |
| UI layer | DOM UI inside the same application shell. | DOM UI with stronger native integration, dialogs, drag/drop, and capabilities. | Usually custom native UI or focused control panels; some projects keep the interface minimal and instrument-like. |
| Native boundary | Rust mostly supports the shell, window control, side services, or relays. | Rust exposes capabilities, file access, native dialogs, and service boundaries more cleanly. | Rust is the application core rather than a support layer. |
| Media and file I/O | Browser media elements are easy to use, but browser security and tainted-texture rules matter. | Same browser strengths, plus better current native file workflows and drop handling. | Native decoders, native camera/video bridges, explicit uploads, and direct file ownership are possible. |
| IPC / control topology | Simple one-window or two-window patterns, often with local relays for split control/render setups. | Same patterns, but updated APIs and clearer capability boundaries for multi-window applications. | Rust-side state and native event/control systems; no browser boundary is required unless intentionally added. |
| Best fit | Fast sketch-to-app work, approachable GPU experiments, and browser-native media logic. | Production-ready WebView tools that still benefit from web ergonomics. | High-performance GPU instruments, compute systems, 3D, heavy media routing, and larger export pipelines. |
| Main constraints | WebView behavior, browser path/security limits, and less direct GPU ownership. | Still a WebView renderer, so browser constraints remain even though shell behavior improves. | More code, more explicit resource management, and a higher implementation burden. |
Junkpile demonstrates a software stack rather than one monolithic product. The idea is that artists and developers can build narrow, cross-platform standalone applications from reusable graphics and media patterns instead of starting from zero every time.
Cross-platform creative application stack
Rendering, controls, media I/O, routing, fullscreen, timing, export, and recovery patterns are treated as reusable building blocks.
The commercial and artistic value comes from small, clear instruments—not from forcing every feature into one giant application.
This stack points toward the broader Scheng model: common engine capability underneath deliberately independent standalone apps.
WebView render path
Native wgpu render path
Neither path is universally better. WebView examples are fast to understand and modify; native wgpu examples expose lower-level performance, compute, resource lifetime, and backend behavior.
Controls and renderer share one document or one hybrid window. State updates are direct and the lifecycle is compact.
Controls and canvas connect to the Rust WebSocket relay. Controls retain authoritative parameters; renderer-local media and GPU history stay in the canvas.
A Tauri WebView owns the interface while Rust owns the wgpu surface. Commands cross IPC; large frame data should not.
p5.js, raw WebGL, external GLSL, live shader editing, WGSL, multipass graphs, compute, raymarching, meshes, skinning, and morphing.
Images, webcam, native camera, video decoding, microphone/audio files, FFT, waveform textures, beat analysis, and image sequences.
Framebuffer feedback, fluid simulation, history buffers, mesh feedback, recording, keyframes, transport, and synchronized outputs.
DOM controls, WebSockets, MIDI, OSC, pointer/touch/pen gestures, Max/MSP, TouchOSC, and native Tauri commands.
Texture mixing, keying, Preview/Program switching, multi-input compositing, projection mapping, and multi-display management.
High-DPI surfaces, 4K–8K working targets, PNG/JPEG output, recording, tiled GPU readback, and production bundles.
min-height: 0 on grid/flex children.p5 fullscreen vertex coordinates: convert 0–1 positions to clip space or output can appear in one quadrant. Global helper names: never declare function location() because it collides
with
window.location. Large binary output: avoid enormous JSON IPC payloads; use bounded chunks, commonly around 1 MiB. Image sequences: buffer before playback, default to hold-every-frame,
and pause timing when decoding falls behind.
The v1 collection begins with paired p5.js, raw WebGL, external GLSL, camera, and feedback lessons; adds native MIDI and OSC bridges; then expands into production-oriented playback, analysis, recording, compositing, switching, mapping, automation, and display management.
The v2 collection preserves the understandable WebGL render path while using Tauri 2 configuration, explicit capabilities, window.__TAURI__.core.invoke(), current WebView-window APIs, native drag/drop, dialogs, and modern
multi-window workflows.
The native collection progresses from surface creation and WGSL to feedback, compute, high resolution, camera/video bridges, MIDI/OSC, gestures, multi-input compositing, glTF, skeletal animation, morph targets, persistent mesh deformation, and tiled 8K export.
Filter by collection or search by folder name, media source, technique, or lesson.
p5-tauri-single-template
p5.js WebGL shader baseline with controls and renderer in one WebView.
p5-tauri-ws-template
p5.js renderer and controls separated through the embedded WebSocket relay.
webgl-tauri-v1-single-template
Explicit WebGL 1 context, shader compilation, program linking, fullscreen quad, uniforms, and render loop.
webgl-tauri-v1-ws-template
Raw WebGL renderer controlled through a reconnect-safe two-window WebSocket protocol.
glsl-tauri-v1-single-template
Runtime fragment-shader loading with compiler diagnostics and last-valid-program retention.
glsl-tauri-v1-ws-template
External GLSL candidates travel to a separate renderer, which validates before activation.
webcam-tauri-v1-single-template
Permission-aware camera capture uploaded to WebGL with effects, telemetry, and optional feedback.
webcam-tauri-v1-ws-template
Renderer-owned camera capture with control-state recovery across WebSocket reconnects.
feedback-tauri-v1-single-template
Ping-pong framebuffer feedback, six temporal modes, palette display, and direct brush injection.
feedback-tauri-v1-ws-template
Two-window temporal feedback with renderer-local GPU history and reconnect-safe control intent.
p5-tauri-midi-template
Rust-owned MIDI enumeration, connection, MIDI learn, mappings, and WebGL parameter control.
p5-tauri-osc-template
Rust UDP/OSC listener with address routing, OSC learn, diagnostics, and visual control.
12-tauri-v1-video-texture-player
Local video transport, seeking, looping, WebGL texture processing, and feedback.
13-tauri-v1-audio-reactive-fft
Microphone input transformed into FFT and waveform textures for GPU-reactive visuals.
14-tauri-v1-canvas-recorder
High-resolution canvas recording with optional microphone audio and native export workflow.
15-tauri-v1-multipass-compositor
Reorderable GPU pass stack with ping-pong targets, feedback, diagnostics, and still export.
16-tauri-v1-image-texture-processor
Native/browser image loading, WebGL processing, comparison views, and high-resolution export.
17-tauri-v1-glsl-shader-playground-terminal
Live GLSL editing, compiler terminal, safe hot reload, presets, shader file I/O, and snapshots.
18-tauri-v1-texture-mixer
Two media layers with blend modes, masks, transforms, native file loading, and high-resolution export.
19-tauri-v1-webcam-compositor
Live keying and compositing against media backgrounds with overlays, recording, and export.
20-tauri-v1-live-video-switcher
Four-source Preview/Program switching, GPU transitions, overlays, transport, and recording.
21-tauri-v1-projection-mapper
Two-window mesh warping, calibration, edge blending, monitor routing, fullscreen, and presets.
22-tauri-v1-image-sequence-player
Native sequence loading, natural sorting, decode-aware cache, interpolation, transport, and output routing.
23-tauri-v1-audio-file-fft-visualizer
Local audio transport, FFT/waveform analysis, beat detection, GLSL visualization, and recording.
24-tauri-v1-keyframe-automation
Editable parameter tracks, interpolation, live automation recording, presets, and native JSON state.
25-tauri-v1-multi-display-output-manager
Three synchronized output windows with monitor placement, fullscreen, layouts, blackout, and snapshots.
p5-tauri-v2-single-template
p5.js WebGL shader baseline with controls and renderer in one WebView.
p5-tauri-v2-ws-template
p5.js renderer and controls separated through the embedded WebSocket relay.
webgl-tauri-v2-single-template
Explicit WebGL 1 context, shader compilation, program linking, fullscreen quad, uniforms, and render loop.
webgl-tauri-v2-ws-template
Raw WebGL renderer controlled through a reconnect-safe two-window WebSocket protocol.
glsl-tauri-v2-single-template
Runtime fragment-shader loading with compiler diagnostics and last-valid-program retention.
glsl-tauri-v2-ws-template
External GLSL candidates travel to a separate renderer, which validates before activation.
webcam-tauri-v2-single-template
Permission-aware camera capture uploaded to WebGL with effects, telemetry, and optional feedback.
webcam-tauri-v2-ws-template
Renderer-owned camera capture with control-state recovery across WebSocket reconnects.
feedback-tauri-v2-single-template
Ping-pong framebuffer feedback, six temporal modes, palette display, and direct brush injection.
feedback-tauri-v2-ws-template
Two-window temporal feedback with renderer-local GPU history and reconnect-safe control intent.
10-tauri-v2-midi-input
Rust-owned MIDI enumeration, connection, MIDI learn, mappings, and WebGL parameter control.
11-tauri-v2-osc-input
Rust UDP/OSC listener with address routing, OSC learn, diagnostics, and visual control.
12-tauri-v2-video-texture-player
Local video transport, seeking, looping, WebGL texture processing, and feedback.
13-tauri-v2-audio-reactive-fft
Microphone input transformed into FFT and waveform textures for GPU-reactive visuals.
14-tauri-v2-canvas-recorder
High-resolution canvas recording with optional microphone audio and native export workflow.
15-tauri-v2-multipass-compositor
Reorderable GPU pass stack with ping-pong targets, feedback, diagnostics, and still export.
16-tauri-v2-image-texture-processor
Native/browser image loading, WebGL processing, comparison views, and high-resolution export.
17-tauri-v2-glsl-shader-playground
Live GLSL editing, compiler terminal, safe hot reload, presets, shader file I/O, and snapshots.
18-tauri-v2-texture-mixer
Two media layers with blend modes, masks, transforms, native file loading, and high-resolution export.
19-tauri-v2-webcam-compositor
Live keying and compositing against media backgrounds with overlays, recording, and export.
20-tauri-v2-live-video-switcher
Four-source Preview/Program switching, GPU transitions, overlays, transport, and recording.
21-tauri-v2-projection-mapper
Two-window mesh warping, calibration, edge blending, monitor routing, fullscreen, and presets.
22-tauri-v2-image-sequence-player
Native sequence loading, natural sorting, decode-aware cache, interpolation, transport, and output routing.
23-tauri-v2-audio-file-fft-visualizer
Local audio transport, FFT/waveform analysis, beat detection, GLSL visualization, and recording.
24-tauri-v2-keyframe-automation
Editable parameter tracks, interpolation, live automation recording, presets, and native JSON state.
25-tauri-v2-multi-display-output-manager
Three synchronized output windows with monitor placement, fullscreen, layouts, blackout, and snapshots.
00-wgpu-surface-probe
Creates a native wgpu surface, selects an adapter, configures presentation, and exposes backend diagnostics.
01-wgpu-resize-fullscreen
Demonstrates robust surface reconfiguration, minimized-window handling, fullscreen, and resize lifecycle.
02-wgpu-wgsl-shader
Builds the minimal native shader pipeline with WGSL, uniforms, a render loop, and telemetry.
03-wgpu-tauri-controls
Connects an HTML control surface to native Rust/wgpu renderer state through Tauri commands.
04-wgpu-image-texture
Loads image pixels into native GPU textures and samples them in a WGSL render pipeline.
05-wgpu-ping-pong-feedback
Uses two HDR render textures for persistent native feedback, transforms, decay, color accumulation, and corruption.
06-wgpu-multipass-render-graph
Makes pass ordering, intermediate textures, and multi-stage native rendering explicit.
07-wgpu-high-resolution-lab
Explores internal render sizes, high-DPI presentation, performance, and 4K–8K working targets.
08-wgpu-backend-lab
Inspects and selects Metal, Vulkan, Direct3D 12, or GL backends and reports adapter limits.
09-wgpu-compute-particles
Updates a large particle system in compute shaders and renders directly from GPU-managed buffers.
10-wgpu-3d-particle-volume
Extends compute particles into a genuine XYZ volume with depth, perspective, and 3D motion.
11-wgpu-volumetric-raymarcher
Ray-marches four procedural 3D scenes with fog, shadows, ambient occlusion, and high-resolution targets.
12-wgpu-compute-fluid-feedback
Runs velocity advection, vorticity, divergence, pressure solve, dye advection, and feedback entirely on the GPU.
13-wgpu-camera-input
Introduces live camera frames as a native-wgpu texture source with capture diagnostics.
14-wgpu-native-webcam-texture
Uses a macOS-native capture bridge to feed webcam frames into persistent GPU textures efficiently.
15-wgpu-native-video-decoder-effect-ui
Uses native FFmpeg decoding, latest-frame BGRA handoff, GPU texture effects, and owned playback state.
16-wgpu-recording
Demonstrates GPU readback, bounded frame handoff, FFmpeg encoding, and recording-state diagnostics.
17-wgpu-midi-parameter-registry
Maps native MIDI events into a stable parameter registry that can drive renderer state and external patches.
18-wgpu-osc-network-control
Routes OSC messages from Max, TouchOSC, Pure Data, or network peers into native renderer parameters.
19-wgpu-gesture-field
Retains pointer, touch, and pen samples and routes them into particle, fluid, depth-ring, and raymarch fields.
20-wgpu-multi-input-compositor
Combines multiple media and generated sources, transport, audio analysis, layers, and GPU compositing.
21-wgpu-gltf-scene-loader
Loads glTF/GLB geometry, materials, textures, depth, lighting, camera controls, and scene diagnostics.
22-wgpu-skeletal-pose-lab
Explores joints, skinning, poses, animation playback, lighting, and bone-overlay diagnostics.
23-wgpu-morph-target-lab
Blends shared-topology target shapes in WGSL using normalized, additive, and sequential modes.
24-wgpu-mesh-feedback-deformer
Uses ping-pong storage buffers for persistent GPU vertex deformation and compute-generated normals.
25-wgpu-ultra-resolution-export
Renders independent HD/4K/6K/8K tiles, reads them back safely, assembles pixels, and exports PNG.
README.md, package.json, src/, and src-tauri/.[workspace] boundary with resolver = "2".npm run dev and npm run build.node_modules/, Rust target/, or generated recordings/exports.Check context creation, shader compile/link status, nonzero drawing-buffer dimensions, viewport, buffers, attributes, texture completeness, and the draw call. The UI should surface these diagnostics rather than remaining blank.
Inspect adapter/backend telemetry, surface compatibility, configuration size, minimized state, resize handling, and current-surface-texture errors. Metal surface creation and UI ownership must respect the main-thread lifecycle.
Keep refresh enabled before permission, request access, enumerate again after permission, verify OS privacy settings, and close other applications holding the device.
The controls window should retain authoritative parameters and resend a complete snapshot when the renderer reconnects. Media streams and GPU history remain renderer-owned.
Have Rust read the native file bytes, return a binary response, create a Blob URL, decode the image, then upload it. Direct asset URLs may display yet remain tainted for texture upload.
Buffer initial frames, hold every frame by default, stop advancing time when decoding falls behind, preserve the playhead when rate changes, and coalesce updates.
Bound queues and memory, avoid huge JSON IPC payloads, respect GPU row alignment, remove padding after readback, and expose progress and failure stages.
Primary workflows were developed and tested sequentially on macOS Apple Silicon. That evidence does not imply a complete macOS, Windows, and Linux certification matrix.
| Status | Current evidence |
|---|---|
| Inventory and documentation | Example catalog cataloged; all three 00–25 collections complete. |
| Runtime | Primary workflows tested sequentially on macOS during development. |
| Standalone packaging | Every project documents local development and production build commands. |
| Windows/Linux | Architecture targets these platforms, but broad runtime verification remains future work; Spout implementation exists but was not fully tested in the primary cycle. |
| Hardware/network inputs | Camera, MIDI, OSC, Syphon, and external Max/MSP workflows were tested where hardware/platform access was available. |
Graphics produced inside WKWebView, WebView2, or WebKitGTK through browser APIs.
A swapchain-like presentation surface owned by Rust/wgpu and backed by Metal, Vulkan, or Direct3D 12.
Alternating two textures or buffers so the previous state can be read while the next state is written.
An explicit description of passes, dependencies, resources, and execution order.
A stable parameter/action model shared by UI, presets, automation, external control, and renderer.
A bounded handoff that discards stale media frames instead of allowing latency and memory growth.