Steps to reproduce
- Go to https://nolanlawson.github.io/mountain-gl/
- Notice the demo works in Firefox/Chrome/Safari but shows nothing in Edge.
The error in console appears to be “Unable to get property ‘enable’ of undefined or null reference” caused by:
var canvas = document.querySelector("canvas"); canvas.width = canvas.offsetWidth; canvas.height = canvas.offsetHeight; var gl = canvas.getContext("webgl"); gl.enable(gl.DEPTH_TEST);
I’ve repro’d in Edge 16199.100 as well as 15063.2.
Comments and activity
- Microsoft Edge Team
Changed Assigned To to “James M.”
Changed Assigned To to “Christian F.”
Changed Assigned To from “Christian F.” to “Rafael C.”
If I look at the MSDN diocumentation, it sends me to the Mozilla description of WebGL.
Load the Mozilla getting started page into Edge, and you will get an alert that webgl failed:
The failure is canvas.getContext(“webgl”); Edge returns null.
I go to Mozilla’s description of getContext():
It shows that getContext(“webgl”) used to be getContest(“experimental-webgl”).
If I use canvas.getContext(“experimental-webgl”) in a clone of the Mozilla example, it works.
To make it a little clearer, fixing this bug is a one-liner.
Just make add the string “webgl” so getContext(“webgl”) and getContext(“experimental-webgl”) return the same context.