Skip to content

Commit

Permalink
stop using twgl.getContext
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jul 31, 2022
1 parent 5360d49 commit f517c87
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/2d-rotation.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion examples/3d-texture-volume-no-buffers.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/3d-texture-volume.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/3d-textures-tone-mapping.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/gpgpu-particles.html
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
2 changes: 1 addition & 1 deletion examples/uniform-buffer-objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/vertex-array-objects.html
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f517c87

Please sign in to comment.