This repository was archived by the owner on May 28, 2022. It is now read-only.
File tree 3 files changed +51
-1
lines changed
3 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 7
7
< style >
8
8
body { margin : 0 ; overflow : hidden; background-color : # 000 ; }
9
9
.tm { position : absolute; top : 10px ; right : 10px ; }
10
+ .webgl-error { font : 15 px/30px monospace; text-align : center; color : # fff ; margin : 50px ; }
11
+ .webgl-error a { color : # fff ; }
10
12
</ style >
11
13
</ head >
12
14
< body >
15
17
< img src ="http://earthatlas.info/img/thematicmapping.png ">
16
18
</ a >
17
19
< script src ="js/three.min.js "> </ script >
20
+ < script src ="js/Detector.js "> </ script >
18
21
< script src ="js/TrackballControls.js "> </ script >
19
22
< script src ="js/earth.js "> </ script >
20
23
</ body >
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @author alteredq / http://alteredqualia.com/
3
+ * @author mr.doob / http://mrdoob.com/
4
+ */
5
+
6
+ var Detector = {
7
+
8
+ canvas : ! ! window . CanvasRenderingContext2D ,
9
+ webgl : ( function ( ) { try { var canvas = document . createElement ( 'canvas' ) ; return ! ! window . WebGLRenderingContext && ( canvas . getContext ( 'webgl' ) || canvas . getContext ( 'experimental-webgl' ) ) ; } catch ( e ) { return false ; } } ) ( ) ,
10
+ workers : ! ! window . Worker ,
11
+ fileapi : window . File && window . FileReader && window . FileList && window . Blob ,
12
+
13
+ getWebGLErrorMessage : function ( ) {
14
+
15
+ var element = document . createElement ( 'div' ) ;
16
+ element . className = 'webgl-error' ;
17
+
18
+ if ( ! this . webgl ) {
19
+
20
+ element . innerHTML = window . WebGLRenderingContext ? [
21
+ 'Your graphics card does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a>.<br />' ,
22
+ 'Find out how to get it <a href="http://get.webgl.org/">here</a>.'
23
+ ] . join ( '\n' ) : [
24
+ 'Your browser does not seem to support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a>.<br/>' ,
25
+ 'Find out how to get it <a href="http://get.webgl.org/">here</a>.'
26
+ ] . join ( '\n' ) ;
27
+
28
+ }
29
+
30
+ return element ;
31
+
32
+ } ,
33
+
34
+ addGetWebGLMessage : function ( parent ) {
35
+
36
+ parent . appendChild ( Detector . getWebGLErrorMessage ( ) ) ;
37
+
38
+ }
39
+
40
+ } ;
Original file line number Diff line number Diff line change 1
1
// Created by Bjorn Sandvik - thematicmapping.org
2
2
( function ( ) {
3
3
4
+ var webglEl = document . getElementById ( 'webgl' ) ;
5
+
6
+ if ( ! Detector . webgl ) {
7
+ Detector . addGetWebGLMessage ( webglEl ) ;
8
+ return ;
9
+ }
10
+
4
11
var width = window . innerWidth ,
5
12
height = window . innerHeight ;
6
13
36
43
37
44
var controls = new THREE . TrackballControls ( camera ) ;
38
45
39
- document . getElementById ( 'webgl' ) . appendChild ( renderer . domElement ) ;
46
+ webglEl . appendChild ( renderer . domElement ) ;
40
47
41
48
render ( ) ;
42
49
You can’t perform that action at this time.
0 commit comments