🎥 Make videos programmatically with React
docs: Point WebGL2 errors to --gl=angle
Kiyeon Jeonef81996609f2
diff --git a/packages/docs/components/demos/HtmlInCanvasDocsDemoWebGL.tsx b/packages/docs/components/demos/HtmlInCanvasDocsDemoWebGL.tsxindex 9385e6fab3..1d9d34ca9a 100644--- a/packages/docs/components/demos/HtmlInCanvasDocsDemoWebGL.tsx+++ b/packages/docs/components/demos/HtmlInCanvasDocsDemoWebGL.tsx@@ -80,7 +80,9 @@ const HtmlInCanvasDocsWebGLInner: React.FC = () => {antialias: false,});if (!gl) {- throw new Error('WebGL2 unavailable');+ throw new Error(+ 'WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.',+ );}gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);diff --git a/packages/docs/docs/remotion/html-in-canvas.mdx b/packages/docs/docs/remotion/html-in-canvas.mdxindex b6e9efa5b1..3340aa90d8 100644--- a/packages/docs/docs/remotion/html-in-canvas.mdx+++ b/packages/docs/docs/remotion/html-in-canvas.mdx@@ -321,7 +321,9 @@ export const HtmlInCanvasDocsMinimalWebGL: React.FC = () => {antialias: false,});if (!gl) {- throw new Error('WebGL2 unavailable');+ throw new Error(+ 'WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.',+ );}gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);diff --git a/packages/docs/docs/transitions/presentations/custom-html-in-canvas.mdx b/packages/docs/docs/transitions/presentations/custom-html-in-canvas.mdxindex 9fca945142..59a77a0595 100644--- a/packages/docs/docs/transitions/presentations/custom-html-in-canvas.mdx+++ b/packages/docs/docs/transitions/presentations/custom-html-in-canvas.mdx@@ -61,7 +61,9 @@ void main() {export const myShader: HtmlInCanvasShader<MyShaderProps> = (canvas) => {const gl = canvas.getContext('webgl2', {premultipliedAlpha: true});if (!gl) {- throw new Error('WebGL2 unavailable');+ throw new Error(+ 'WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.',+ );}// Compile + link program, create textures, bind a fullscreen quad...diff --git a/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx b/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsxindex c2902b1469..532a958e52 100644--- a/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx+++ b/packages/example/src/HtmlInCanvas/compose-webgl-crt.tsx@@ -127,7 +127,9 @@ export const HtmlInCanvasComposeWebGLCrt: React.FC = () => {antialias: false,});if (!gl) {- throw new Error('WebGL2 unavailable');+ throw new Error(+ 'WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.',+ );}gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);diff --git a/packages/example/src/HtmlInCanvas/compose-webgl.tsx b/packages/example/src/HtmlInCanvas/compose-webgl.tsxindex 7848c8a4d7..48dcadacd4 100644--- a/packages/example/src/HtmlInCanvas/compose-webgl.tsx+++ b/packages/example/src/HtmlInCanvas/compose-webgl.tsx@@ -81,7 +81,9 @@ export const HtmlInCanvasComposeWebGL: React.FC = () => {antialias: false,});if (!gl) {- throw new Error('WebGL2 unavailable');+ throw new Error(+ 'WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.',+ );}gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);diff --git a/packages/example/src/HtmlInCanvas/minimal-docs-webgl.tsx b/packages/example/src/HtmlInCanvas/minimal-docs-webgl.tsxindex 74107c998c..4138f9cddb 100644--- a/packages/example/src/HtmlInCanvas/minimal-docs-webgl.tsx+++ b/packages/example/src/HtmlInCanvas/minimal-docs-webgl.tsx@@ -79,7 +79,9 @@ export const HtmlInCanvasDocsMinimalWebGL: React.FC = () => {antialias: false,});if (!gl) {- throw new Error('WebGL2 unavailable');+ throw new Error(+ 'WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.',+ );}gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);diff --git a/packages/skills/skills/remotion/rules/html-in-canvas.md b/packages/skills/skills/remotion/rules/html-in-canvas.mdindex 7496800889..def5a9803a 100644--- a/packages/skills/skills/remotion/rules/html-in-canvas.md+++ b/packages/skills/skills/remotion/rules/html-in-canvas.md@@ -97,7 +97,11 @@ For WebGL, set up the context, program, and texture in `onInit` and return a cle```tsxconst onInit: HtmlInCanvasOnInit = useCallback(({ canvas }) => {const gl = canvas.getContext("webgl2", { alpha: true, premultipliedAlpha: true });- if (!gl) throw new Error("WebGL2 unavailable");+ if (!gl) {+ throw new Error(+ "WebGL2 unavailable. Try rendering with the --gl=angle option. See https://remotion.dev/docs/gl-options.",+ );+ }gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);// compile program, create texture, set up VAO...return () => {