/
githubmirror
/
servo
Обзор
Документация
Войти
/
githubmirror
/
servo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
tests/html/test_webgl_context_attributes.html
39 строк
1 KB
ecoal95
Add WebGLContextAttributes support
01 июн 2015, 16:29
01 июн 2015, 16:29
b3ac346
Код
Авторство
О чём код?
<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>