andreasgal / B2G

Boot to Gecko aims to create a complete, standalone operating system for the open web.
https://wiki.mozilla.org/B2G
907 stars 158 forks source link

WebGL context from canvas with width = height = 0 #313

Closed Maksims closed 3 years ago

Maksims commented 11 years ago

If canvas width == 0 and height == 0 it will fails to create context. It require bigger resolution, with 320x240 works.

html:

<canvas id='render' width='0' height='0'></canvas>

js:

var canvas = document.getElementById('render');
try {
  var gl = canvas.getContext('experimental-webgl');
} catch(e) {
  console.log(e); // Exception... "Failure"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"
}