mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
This commit also: * Allows to return non-rootable dictionaries from Codegen. * Merges the two context types in an enum type.
39 lines
1.1 KiB
HTML
39 lines
1.1 KiB
HTML
<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>
|