Note: This page covers Parcel 1, the documentation for Parcel 2 is being worked on here:

OpenGL Shading Language (GLSL)

Supported extensions: glsl, vert, frag

Examples of GLSL code

Fragment shader


#pragma glslify: snoise3 = require(glsl-noise/simplex/3d)
attribute vec3 position;
void main() {
  gl_FragColor = vec4(snoise3(position), 1.0);

You can then import the transpiled version and use the string in WebGL:

import frag from './shader.frag'

// ...
gl.shaderSource(..., frag);
// ...

Help us improve the docs

If something is missing or not entirely clear, please file an issue on the website repository or edit this page.