You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							88 lines
						
					
					
						
							4.5 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							88 lines
						
					
					
						
							4.5 KiB
						
					
					
				
								<!DOCTYPE html><html lang="en"><head>
							 | 
						|
								    <meta charset="utf-8">
							 | 
						|
								    <title>Setup</title>
							 | 
						|
								    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
							 | 
						|
								    <meta name="twitter:card" content="summary_large_image">
							 | 
						|
								    <meta name="twitter:site" content="@threejs">
							 | 
						|
								    <meta name="twitter:title" content="Three.js – Setup">
							 | 
						|
								    <meta property="og:image" content="https://threejs.org/files/share.png">
							 | 
						|
								    <link rel="shortcut icon" href="/files/favicon_white.ico" media="(prefers-color-scheme: dark)">
							 | 
						|
								    <link rel="shortcut icon" href="/files/favicon.ico" media="(prefers-color-scheme: light)">
							 | 
						|
								
							 | 
						|
								    <link rel="stylesheet" href="/manual/resources/lesson.css">
							 | 
						|
								    <link rel="stylesheet" href="/manual/resources/lang.css">
							 | 
						|
								<!-- Import maps polyfill -->
							 | 
						|
								<!-- Remove this when import maps will be widely supported -->
							 | 
						|
								<script async src="https://unpkg.com/es-module-shims@1.3.6/dist/es-module-shims.js"></script>
							 | 
						|
								
							 | 
						|
								<script type="importmap">
							 | 
						|
								{
							 | 
						|
								  "imports": {
							 | 
						|
								    "three": "../../build/three.module.js"
							 | 
						|
								  }
							 | 
						|
								}
							 | 
						|
								</script>
							 | 
						|
								  </head>
							 | 
						|
								  <body>
							 | 
						|
								    <div class="container">
							 | 
						|
								      <div class="lesson-title">
							 | 
						|
								        <h1>Setup</h1>
							 | 
						|
								      </div>
							 | 
						|
								      <div class="lesson">
							 | 
						|
								        <div class="lesson-main">
							 | 
						|
								          <p>This article is one in a series of articles about three.js.
							 | 
						|
								The first article was <a href="fundamentals.html">about three.js fundamentals</a>.
							 | 
						|
								If you haven't read that yet you might want to start there.</p>
							 | 
						|
								<p>Before we go any further we need to talk about setting up your
							 | 
						|
								computer as a development environment. In particular, for security reasons,
							 | 
						|
								WebGL cannot use images from your hard drive directly. That means
							 | 
						|
								in order to do development you need to use a web server. Fortunately
							 | 
						|
								development web servers are super easy to setup and use.</p>
							 | 
						|
								<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>.
							 | 
						|
								Once downloaded double click the zip file to unpack the files.</p>
							 | 
						|
								<p>Next download one of these simple web servers.</p>
							 | 
						|
								<p>If you'd prefer a web server with a user interface there's
							 | 
						|
								<a href="https://greggman.github.io/servez">Servez</a></p>
							 | 
						|
								<p></p><div class="threejs_image border">
							 | 
						|
								  <img class="" src="../resources/servez.gif">
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
								<p></p>
							 | 
						|
								<p>Just point it at the folder where you unzipped the files, click "Start", then go to
							 | 
						|
								in your browser <a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a> or if you'd
							 | 
						|
								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>
							 | 
						|
								<p>To stop serving click stop or quit Servez.</p>
							 | 
						|
								<p>If you prefer the command line (I do), another way is to use <a href="https://nodejs.org">node.js</a>.
							 | 
						|
								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>
							 | 
						|
								<p>Then install the <a href="https://github.com/greggman/servez-cli"><code class="notranslate" translate="no">servez</code></a> by typing</p>
							 | 
						|
								<pre class="prettyprint showlinemods notranslate notranslate" translate="no">npm -g install servez
							 | 
						|
								</pre><p>If you're on OSX use</p>
							 | 
						|
								<pre class="prettyprint showlinemods notranslate notranslate" translate="no">sudo npm -g install servez
							 | 
						|
								</pre><p>Once you've done that type</p>
							 | 
						|
								<pre class="prettyprint showlinemods notranslate notranslate" translate="no">servez path/to/folder/where/you/unzipped/files
							 | 
						|
								</pre><p>Or if you're like me</p>
							 | 
						|
								<pre class="prettyprint showlinemods notranslate notranslate" translate="no">cd path/to/folder/where/you/unzipped/files
							 | 
						|
								servez
							 | 
						|
								</pre><p>It should print something like</p>
							 | 
						|
								<p></p><div class="threejs_image ">
							 | 
						|
								  <img class="" src="../resources/servez-response.png">
							 | 
						|
								</div>
							 | 
						|
								
							 | 
						|
								<p></p>
							 | 
						|
								<p>Then in your browser go to <a href="http://localhost:8080/"><code class="notranslate" translate="no">http://localhost:8080/</code></a>.</p>
							 | 
						|
								<p>If you don't specify a path then servez will serve the current folder.</p>
							 | 
						|
								<p>If either of those options are not to your liking
							 | 
						|
								<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>
							 | 
						|
								<p>Now that you have a server setup we can move on to <a href="textures.html">textures</a>.</p>
							 | 
						|
								
							 | 
						|
								        </div>
							 | 
						|
								      </div>
							 | 
						|
								    </div>
							 | 
						|
								  
							 | 
						|
								  <script src="/manual/resources/prettify.js"></script>
							 | 
						|
								  <script src="/manual/resources/lesson.js"></script>
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								</body></html>
							 | 
						|
								
							 |