canvas.getContext("webgl") is undefined

Issue #12125200 • Assigned to Rafael C.

Details

Author
Nolan L.
Created
May 25, 2017
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
15.16199
Reports
Reported by 2 people

Sign in to watch or report this issue.

Steps to reproduce

  1. Go to https://nolanlawson.github.io/mountain-gl/
  2. 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.

Attachments

0 attachments

    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:

      https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Tutorial/Getting_started_with_WebGL

      The failure is canvas.getContext(“webgl”); Edge returns null.

      I go to Mozilla’s description of getContext():

      https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/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.

    You need to sign in to your Microsoft account to add a comment.

    Sign in