Skip to content

Instantly share code, notes, and snippets.

@dy
Last active January 9, 2023 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dy/287ae55682f4f5f8053bfff21a7f01ce to your computer and use it in GitHub Desktop.
Save dy/287ae55682f4f5f8053bfff21a7f01ce to your computer and use it in GitHub Desktop.
why-not-stackgl

Why not stackgl

Learning WebGL is difficult.

What I’ve understood so far, after 3+ months experience with WebGL? stackgl is a set of tools somewhere in-between raw WebGL API and graphic frameworks like three.js. But the purpose of these tools is not completely clear.

I guess the motive behing things like gl-shader

glslify

Conceived as an analog to browserify, the idea to include dependencies tree applied to shaders seemed promising. But reality of shaders is different. Examples:

  • Dynamically set precision of floats: precision ${this.precision} float

  • Define constants through options: const int WIDTH = ${this.width}

  • Set precision declaration once for all shaders

  • Include part of external glslify module instead of importing it

  • Sourcemap lines are messed up - debugging is impossible

  • deps tree or dup resolving is not really necessary - shader code is rarely too huge, it is often linear.

Guess I should come up with something like debugger

debug(gl, source);

which enables log() command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment