setup.html 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <!DOCTYPE html><html lang="en"><head>
  2. <meta charset="utf-8">
  3. <title>Setup</title>
  4. <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  5. <meta name="twitter:card" content="summary_large_image">
  6. <meta name="twitter:site" content="@threejs">
  7. <meta name="twitter:title" content="Three.js – Setup">
  8. <meta property="og:image" content="https://threejs.org/files/share.png">
  9. <link rel="shortcut icon" href="/files/favicon_white.ico" media="(prefers-color-scheme: dark)">
  10. <link rel="shortcut icon" href="/files/favicon.ico" media="(prefers-color-scheme: light)">
  11. <link rel="stylesheet" href="/manual/resources/lesson.css">
  12. <link rel="stylesheet" href="/manual/resources/lang.css">
  13. </head>
  14. <body>
  15. <div class="container">
  16. <div class="lesson-title">
  17. <h1>Setup</h1>
  18. </div>
  19. <div class="lesson">
  20. <div class="lesson-main">
  21. <p>This article is one in a series of articles about three.js.
  22. The first article was <a href="fundamentals.html">about three.js fundamentals</a>.
  23. If you haven't read that yet you might want to start there.</p>
  24. <p>Before we go any further we need to talk about setting up your
  25. computer to do development. In particular, for security reasons,
  26. WebGL cannot use images from your hard drive directly. That means
  27. in order to do development you need to use a web server. Fortunately
  28. development web servers are super easy to setup and use.</p>
  29. <p>First off if you'd like you can download this entire site from <a href="https://github.com/gfxfundamentals/threejsfundamentals/archive/gh-pages.zip">this link</a>.
  30. Once downloaded double click the zip file to unpack the files.</p>
  31. <p>Next download one of these simple web servers.</p>
  32. <p>If you'd prefer a web server with a user interface there's
  33. <a href="https://greggman.github.io/servez">Servez</a></p>
  34. <p></p><div class="threejs_image border">
  35. <img class="" src="../resources/servez.gif">
  36. </div>
  37. <p></p>
  38. <p>Just point it at the folder where you unzipped the files, click "Start", then go to
  39. in your browser <a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a> or if you'd
  40. like to browse the samples go to <a href="http://localhost:8080/threejs"><code class="notranslate" translate="no">http://localhost:8080/threejs</code></a>.</p>
  41. <p>To stop serving pick stop or quit Servez.</p>
  42. <p>If you prefer the command line (I do), another way is to use <a href="https://nodejs.org">node.js</a>.
  43. Download it, install it, then open a command prompt / console / terminal window. If you're on Windows the installer will add a special "Node Command Prompt" so use that.</p>
  44. <p>Then install the <a href="https://github.com/greggman/servez-cli"><code class="notranslate" translate="no">servez</code></a> by typing</p>
  45. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">npm -g install servez
  46. </pre><p>If you're on OSX use</p>
  47. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">sudo npm -g install servez
  48. </pre><p>Once you've done that type</p>
  49. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">servez path/to/folder/where/you/unzipped/files
  50. </pre><p>Or if you're like me</p>
  51. <pre class="prettyprint showlinemods notranslate notranslate" translate="no">cd path/to/folder/where/you/unzipped/files
  52. servez
  53. </pre><p>It should print something like</p>
  54. <p></p><div class="threejs_image ">
  55. <img class="" src="../resources/servez-response.png">
  56. </div>
  57. <p></p>
  58. <p>Then in your browser go to <a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a>.</p>
  59. <p>If you don't specify a path then servez will serve the current folder.</p>
  60. <p>If either of those options are not to your liking
  61. <a href="https://stackoverflow.com/questions/12905426/what-is-a-faster-alternative-to-pythons-servez-or-simplehttpserver">there are many other simple servers to choose from</a>.</p>
  62. <p>Now that you have a server setup we can move on to <a href="textures.html">textures</a>.</p>
  63. </div>
  64. </div>
  65. </div>
  66. <script src="/manual/resources/prettify.js"></script>
  67. <script src="/manual/resources/lesson.js"></script>
  68. </body></html>