Answer the question
In order to leave comments, you need to log in
How to determine if a browser supports WebGL?
How to programmatically determine browser WebGL support in JS?
Answer the question
In order to leave comments, you need to log in
function initWebGL(canvas) {
gl = null;
try {
// Попытаться получить стандартный контекст. Если не получится, попробовать получить экспериментальный.
gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
}
catch(e) {}
// Если мы не получили контекст GL, завершить работу
if (!gl) {
alert("Unable to initialize WebGL. Your browser may not support it.");
gl = null;
}
return gl;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question