Shadertoy style

glint · Examples · Tutorials · Gallery

Paste Shadertoy code into mainImage: iTime, iResolution, iMouse and iChannel0..3 are filled in.

Shadertoy style: a GLSL shader

An example in glint, a free live shader editor in the browser: the GLSL code floats over the running picture and recompiles as you type.

The code

One pass, in GLSL.

fragment shader

#version 300 es
precision highp float;

uniform vec3 iResolution;
uniform float iTime;
uniform float iTimeDelta;
uniform int iFrame;
uniform vec4 iMouse;
uniform vec4 iDate;
uniform sampler2D iChannel0;
uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannel3;

out vec4 fragColor;

// ---- paste Shadertoy code below ----

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec3 col = 0.5 + 0.5 * cos(iTime + uv.xyx + vec3(0, 2, 4));
    fragColor = vec4(col, 1.0);
}

// ---- end ----

void main() {
    mainImage(fragColor, gl_FragCoord.xy);
}

More Starters examples

Audio spectrum · Vertex art · Lit mesh · Webcam kaleidoscope · Plasma · Tunnel · Mandelbrot & Julia · Reaction–diffusion