Skip to content

Commit

Permalink
Added a WebGL checker and a warning; also bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cresythe authored Jan 5, 2024
1 parent 1f3e7fb commit 5c76a39
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions fogTesting.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import WebGL from 'three/addons/capabilities/WebGL.js';

const scene = new THREE.Scene();
//for foreground fog
Expand All @@ -34,7 +35,6 @@
const renderer = new THREE.WebGLRenderer();
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.outputColorSpace = THREE.sRGBEncoding;

renderer.setSize( window.innerWidth, window.innerHeight);
document.body.appendChild( renderer.domElement);
Expand Down Expand Up @@ -84,7 +84,16 @@

renderer.render(scene, camera);
}
animate();
if ( WebGL.isWebGLAvailable() ) {

// Initiate function or other initializations here
animate();

} else {

const warning = WebGL.getWebGLErrorMessage();
document.getElementById( 'module' ).appendChild( warning );
}
</script>
</body>
</html>

0 comments on commit 5c76a39

Please sign in to comment.