From f517c878dd693ac0614c696a30742708121b844c Mon Sep 17 00:00:00 2001 From: Gregg Tavares Date: Sat, 30 Jul 2022 20:15:13 -0700 Subject: [PATCH] stop using twgl.getContext --- examples/2d-rotation.html | 2 +- examples/3d-texture-volume-no-buffers.html | 2 +- examples/3d-texture-volume.html | 2 +- examples/3d-textures-tone-mapping.html | 2 +- examples/gpgpu-particles.html | 2 +- examples/uniform-buffer-objects.html | 2 +- examples/vertex-array-objects.html | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/2d-rotation.html b/examples/2d-rotation.html index 14025097..f42a4679 100644 --- a/examples/2d-rotation.html +++ b/examples/2d-rotation.html @@ -60,7 +60,7 @@ }`; const canvas = document.getElementById('canvasgl'); - const gl = twgl.getContext(canvas, {depth: false }); + const gl = canvas.getContext('webgl', {depth: false}); const programInfo = twgl.createProgramInfo(gl, [vsource, fsource]); gl.useProgram(programInfo.program); diff --git a/examples/3d-texture-volume-no-buffers.html b/examples/3d-texture-volume-no-buffers.html index 36b7b38e..b62b9f94 100644 --- a/examples/3d-texture-volume-no-buffers.html +++ b/examples/3d-texture-volume-no-buffers.html @@ -106,7 +106,7 @@ function main() { const m4 = twgl.m4; twgl.setDefaults({attribPrefix: "a_"}); - const gl = twgl.getContext(document.getElementById("c")); + const gl = document.getElementById("c").getContext('webgl2'); console.log("using: " + gl.getParameter(gl.VERSION)); // eslint-disable-line if (!twgl.isWebGL2(gl)) { alert("Sorry, this example requires WebGL 2.0"); // eslint-disable-line diff --git a/examples/3d-texture-volume.html b/examples/3d-texture-volume.html index 60d40fff..0bd8b17b 100644 --- a/examples/3d-texture-volume.html +++ b/examples/3d-texture-volume.html @@ -97,7 +97,7 @@ function main() { const m4 = twgl.m4; twgl.setDefaults({attribPrefix: "a_"}); - const gl = twgl.getContext(document.getElementById("c")); + const gl = document.getElementById("c").getContext('webgl2'); console.log("using: " + gl.getParameter(gl.VERSION)); // eslint-disable-line if (!twgl.isWebGL2(gl)) { alert("Sorry, this example requires WebGL 2.0"); // eslint-disable-line diff --git a/examples/3d-textures-tone-mapping.html b/examples/3d-textures-tone-mapping.html index e013ab15..5cd51042 100644 --- a/examples/3d-textures-tone-mapping.html +++ b/examples/3d-textures-tone-mapping.html @@ -67,7 +67,7 @@ function main() { const m4 = twgl.m4; twgl.setDefaults({attribPrefix: "a_"}); - const gl = twgl.getContext(document.getElementById("c")); + const gl = document.getElementById("c").getContext('webgl2'); console.log("using: " + gl.getParameter(gl.VERSION)); // eslint-disable-line if (!twgl.isWebGL2(gl)) { alert("Sorry, this example requires WebGL 2.0"); // eslint-disable-line diff --git a/examples/gpgpu-particles.html b/examples/gpgpu-particles.html index 85777a4b..5fb74462 100644 --- a/examples/gpgpu-particles.html +++ b/examples/gpgpu-particles.html @@ -120,7 +120,7 @@ const mousepos = [0.5, 0.5]; const canvas = document.getElementById('canvasgl'); - const gl = twgl.getContext(canvas, { depth: false, antialiasing: false }); + const gl = canvas.getContext('webgl', { depth: false, antialiasing: false }); const programInit = twgl.createProgramInfo(gl, [vInit, fInit]); const programPhysics = twgl.createProgramInfo(gl, [vPhysics, fPhysics]); diff --git a/examples/uniform-buffer-objects.html b/examples/uniform-buffer-objects.html index aa2dee71..afe2d570 100644 --- a/examples/uniform-buffer-objects.html +++ b/examples/uniform-buffer-objects.html @@ -145,7 +145,7 @@ function main() { const m4 = twgl.m4; twgl.setDefaults({attribPrefix: "a_"}); - const gl = twgl.getContext(document.getElementById("c")); + const gl = document.getElementById("c").getContext('webgl2'); console.log("using:" + gl.getParameter(gl.VERSION)); // eslint-disable-line if (!twgl.isWebGL2(gl)) { alert("Sorry, this example requires WebGL 2.0"); // eslint-disable-line diff --git a/examples/vertex-array-objects.html b/examples/vertex-array-objects.html index 33477765..d82401c0 100644 --- a/examples/vertex-array-objects.html +++ b/examples/vertex-array-objects.html @@ -179,7 +179,7 @@ import * as twgl from '../dist/4.x/twgl-full.module.js'; twgl.setDefaults({attribPrefix: "a_"}); const m4 = twgl.m4; - const gl = twgl.getContext(document.getElementById("c")); + const gl = document.getElementById("c").getContext('webgl2'); if (!gl.createVertexArray) { alert("requires OES_vertex_array_object extension or WebGL 2"); // eslint-disable-line }