Catch create WebGLRenderer error

This commit is contained in:
Tanner Collin 2022-03-14 04:42:06 +00:00
parent 58a6b2a418
commit 39fde2cefc

View File

@ -13,7 +13,13 @@ export const scene = ({ ref }) => {
var scene = new THREE.Scene(); var scene = new THREE.Scene();
const renderer = new THREE.WebGLRenderer({ antialias: true }); let renderer = null;
try {
renderer = new THREE.WebGLRenderer({ antialias: true });
} catch (error) {
console.log('Problem creating WebGLRenderer:', error);
return;
}
const width = ref.current.clientWidth; const width = ref.current.clientWidth;
const height = ref.current.clientHeight; const height = ref.current.clientHeight;