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

OpenGL Shading Language (GLSL)

Supported extensions: glsl, vert, frag

Examples of GLSL code

Fragment shader

shader.frag:

#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);
// ...