WebGL2 is not backwards-compatible with WebGL. You have to use #version 300 es
shaders that have different structure (as different GLSL version):
Ex1. WebGL1 GLSL (vertex):
attribute vec3 position;
void main() {
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
Ex2. WebGL2 GLSL (vertex):
in vec3 position;
out vec4 myOutputPosition;
void main() {
myOutputPosition = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
Therefore, great Webgl1 engines can't be moved to Webgl2 without rewriting their core. And because of that some of them decided to not to move to Webgl2 (as regl did), or to just implement it particularly (as Three.js did).
To make a lightweight WebGL2-only library that will support Tree-shaking (as Three.js doesn't), modular workflow and other features in the list:
- MSDF shadows. MSDF explanation
ShaderBuilder
: compile shaders on the go from multiple chunks.- Extended shader library with physically-based rendering utils & bigger shader chunks collection.
- (possible) Raytrace renderer.
- Easier framebuffers workflow.
- Easier work with textures
- Semi-procedural way of framebuffers/textures processing. (aka super-simple effect composer)
- 3D textures support
- Enhanced particle systems API. (That makes it easier to integrate particles with physics engines like particulate.js
- TODO.