This project is part of the @thi.ng/umbrella monorepo.
Basic WebGL scaffolding for running interactive fragment shaders defined via @thi.ng/shader-ast.
ALPHA - multi-pass support forthcoming
yarn add @thi.ng/webgl-shadertoy
import { glCanvas } from "@thi.ng/webgl";
import { shaderToy } from "@thi.ng/webgl-shadertoy";
import { assign, div, mul, ret, vec4 } from "@thi.ng/shader-ast";
const canvas = glCanvas({
width: 600,
height: 600,
parent: document.body,
version: 2
});
const toy = shaderToy({
canvas: canvas.canvas
gl: canvas.gl,
main: (gl, unis) => [
assign(unis.mouse, div(unis.mouse, unis.res)),
ret(vec4(mul(mouse, div(gl.gl_FragCoord, res)), 0, 1))
]
});
toy.start();
- Karsten Schmidt
© 2018 Karsten Schmidt // Apache Software License 2.0