Преглед изворни кода

Moved page from Wiki to manual

Lewy Blue пре 8 година
родитељ
комит
106886a3c4
2 измењених фајлова са 33 додато и 0 уклоњено
  1. 1 0
      docs/list.js
  2. 32 0
      docs/manual/introduction/Detecting-WebGL-and-browser-compatibility.html

+ 1 - 0
docs/list.js

@@ -3,6 +3,7 @@ var list = {
 	"Manual": {
 	"Manual": {
 		"Introduction": [
 		"Introduction": [
 			[ "Creating a scene", "manual/introduction/Creating-a-scene" ],
 			[ "Creating a scene", "manual/introduction/Creating-a-scene" ],
+			[ "Detecting WebGL and browser compatibility", "manual/introduction/Detecting-WebGL-and-browser-compatibility" ],
 			[ "Drawing Lines", "manual/introduction/Drawing-lines" ],
 			[ "Drawing Lines", "manual/introduction/Drawing-lines" ],
 			[ "Creating Text", "manual/introduction/Creating-text" ],
 			[ "Creating Text", "manual/introduction/Creating-text" ],
 			[ "Code Style Guide", "manual/introduction/Code-style-guide" ],
 			[ "Code Style Guide", "manual/introduction/Code-style-guide" ],

+ 32 - 0
docs/manual/introduction/Detecting-WebGL-and-browser-compatibility.html

@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8">
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1><br />
+		<p>
+			Even those this is becming less and less of a problem, some devices or browsers may not support WebGL.
+			Here is how to check if it is supported and display a warning to the user if it is not.
+		</p>
+
+		<h2>A solution</h2>
+
+		<p>In order to detect webgl compatibility and gracefully inform the user you can add <a href="https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js">https://github.com/mrdoob/three.js/blob/master/examples/js/Detector.js</a> to your javascript and use this example to avoid even attempting to render anything:</p>
+
+		<pre><code>if (Detector.webgl) {
+		    init();
+		    animate();
+		} else {
+		    var warning = Detector.getWebGLErrorMessage();
+		    document.getElementById('container').appendChild(warning);
+		}
+		</code></pre>
+
+
+	</body>
+</html>