Reputation: 3233
In my HTML, following code portion
if (WEBGL.isWebGLAvailable()==false) {
document.body.appendChild(WEBGL.getWebGLErrorMessage());
}
generates following error on console:
Uncaught ReferenceError: WEBGL is not defined
I am already importing all necessary js, so the question is: how do you solve this?
Upvotes: 1
Views: 3223
Reputation: 18889
Seems like you're using three.js library.
As the docs mention:
Add https://github.com/mrdoob/three.js/blob/master/examples/jsm/WebGL.js to your javascript and run the following before attempting to render anything.
if ( WEBGL.isWebGLAvailable() ) {
// Initiate function or other initializations here
animate();
} else {
var warning = WEBGL.getWebGLErrorMessage();
document.getElementById( 'container' ).appendChild( warning );
}
So I don't think you actually loaded the required script.
Source: https://threejs.org/docs/#manual/en/introduction/WebGL-compatibility-check
Upvotes: 2