Add WebGLContextAttributes support

This commit also:
* Allows to return non-rootable dictionaries from
Codegen.
* Merges the two context types in an enum type.
This commit is contained in:
ecoal95 2015-05-25 14:47:23 +02:00
parent b1a773a15b
commit b3ac346749
16 changed files with 255 additions and 80 deletions

View file

@ -0,0 +1,39 @@
<meta charset="utf-8">
<title>WebGL Context Attributes test</title>
<script>
(function () {
var canvas = document.createElement('canvas'),
closure = function() {},
gl, attributes;
closure.alpha = false;
closure.antialias = "";
gl = canvas.getContext("webgl", closure);
if ( ! gl ) {
console.log("Passing a closure to `getContext` didn't generate a context");
gl = canvas.getContext("webgl", { alpha: false, antialias: "" });
}
if ( ! gl ) {
console.error("Unable to generate a WebGL context");
return;
}
attributes = gl.getContextAttributes();
console.log("Got context attributes: ", JSON.stringify(attributes));
if ( attributes.alpha )
console.error("Alpha not expected");
if ( attributes.antialias )
console.error("Antialias not expected, should be casted to false");
gl = canvas.getContext("webgl", { alpha: true });
attributes = gl.getContextAttributes();
if ( attributes.alpha )
console.error("Should have returned the previous context attributes");
})();
</script>