What’s on our mind?

Collection of articles, design, site, and resources made by designers and publisher @Menu View

index48
import {
    FragmentShader,
    Texture,
    Uniform
} from 'https://cdn.skypack.dev/wtc-gl@1.0.0-beta.23';

const shaderF = document.querySelector('#fragShader').innerText;

const FSWrapper = new FragmentShader({
    fragment: shaderF
});

const {
    gl,
    uniforms
} = FSWrapper;

const texture = new Texture(gl, {
    wrapS: gl.REPEAT,
    wrapT: gl.REPEAT
});

const img = new Image();
img.crossOrigin = "anonymous";
img.src = "https://assets.codepen.io/982762/noise.png";
img.onload = () => (texture.image = img);

uniforms.s_noise = new Uniform({
    name: "noise",
    value: texture,
    kind: "texture"
});