v5.0.0
Support WebGL2
- WebGL2 is used by default in this new gl-react version. gl-react-dom's Surface can be overriden to still force the usage of webgl 1:
version="webgl"
prop. Only reason you might need it is to be supporting older browser that would not support WebGL2 (see https://caniuse.com/webgl2). This is the one and only reason why we are going to release a MAJOR bump on gl-react. Apart from this user's choice, there are no expected breaking changes. - WebGL1 shaders (ES 1.0) are still supported as is without you to need to change anything. WebGL2 supports ES 1.0 shaders.
- WebGL2 shaders (ES 3.0) are supported by defining
#version 300 es
. A vertex shader of that version will also will be provided. There is currently no other version supported (unless you provide yourself the associated "vert"). - There were changes needed in the ndarray support, but everything should be backward compatible.
Migration to ES 3.0
A few changes can be done to migrate a GLSL shader to ES 3.0.
- prefix it with
#version 300 es
- replace all
varying
within
. Basically only onvarying vec2 uv;
- add a
out vec4 fragColor;
(you can chose whatever naming you want on that variable likecolor
) and replace the usage of setting thegl_FragColor
to your newout vec4
variable.
Example:
before:
precision highp float;
varying vec2 uv;
void main() {
gl_FragColor = vec4(uv.x, uv.y, 0.5, 1.0);
}
after:
#version 300 es
precision highp float;
in vec2 uv;
out vec4 color;
void main() {
color = vec4(uv.x, uv.y, 0.5, 1.0);
}
Others
- gl-react-dom to allow Surface to be absolute positionned
- Upgrade dependencies