WebGL.isWebGL2Available crashes renderer

Getting a context a second time after the first one is gotten, destroys the first context.

WebGL is available on all the browsers but opera mini.

WebGL/WebGL2 is available on all the browsers ^ but opera mini and IE 11.

If you create your renderer without checking webGLAvailable first… it will throw an exception that you can catch.

try{
renderer = new THREE.WebGLRenderer()
}
catch( error ){
console.error( “WebGL is broken or unavailable:”, error)
}

Using the isWebGLAvailable shim is really not a big deal. I know it seems inefficient but it’s really just a blip.

And if you don’t use it, and instead just try to create your renderer, you can see what errors it may throw here:

1 Like