Skip to content

Latest commit

 

History

History

webgl-shadertoy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

@thi.ng/webgl-shadertoy

npm (scoped) npm downloads Twitter Follow

This project is part of the @thi.ng/umbrella monorepo.

About

Basic WebGL scaffolding for running interactive fragment shaders defined via @thi.ng/shader-ast.

Status

ALPHA - multi-pass support forthcoming

Installation

yarn add @thi.ng/webgl-shadertoy

Dependencies

Usage examples

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();

Authors

  • Karsten Schmidt

License

© 2018 Karsten Schmidt // Apache Software License 2.0