Skip to 0 minutes and 19 secondsHello everyone, Alun Evans here and welcome to the first lesson on programming 3D graphics on the web. Before we get started with the code, I just want to review the setup that we’re going to use to do our programming. I’m sure it’ll be quite familiar to many web programmers, we’re going to use a localhost; although 3D graphics using WebGL doesn’t actually need a server, it doesn’t use any server technology, runs all on the client usually, but because we’re going to be downloading some assets, some meshes and some images, we want to avoid any cross-origin errors, so we’re going to setup a localhost. The localhost that I like to use is the one that comes installed with Python.
Skip to 1 minute and 6 secondsIf you have Python installed in your system you can very quickly go to the command line here and type in “python –m SimpleHTTPServer". This is with Python 2.7, I think the syntax is slightly different with Python 3, and then you’re serving HTTP on port 8000, so we can go now to our localhost, and I’ll just quickly get rid of this, and let me see a Hello World. And what I made in the setup here is a very simple HTML file in the directory where I’m serving my content, which is a very simple basic setup, just zeroing out the margin and the padding on the body so we have no white border boundary on our coding.
Skip to 1 minute and 53 secondsSo, there are other localhosts you can run, you can download and run Apache or one of several softwares that will run a localhost in your machine. I use the Python, I know it’s not the fastest but it works perfectly well, and that will enable us to start working in a local environment without having to worry about uploading assets to a remote server. Ok? See you in the next lesson.
Setting up the localhost
This week, we will enhance our 3D scenes by writing code.
In the video, Alun Evans explains how to set up the run-time environment required to execute your code.
There are several ways of setting up a localhost using different software packages and programming languages. Alun will be using Python, but you can also use a PHP built-in server or an Apache server.
See the links below for more information.
Downloadable resources for the course
All the source code and resources used in following steps for this part of the course are included in “Course Downloads.zip” which is available in the Downloads section at the end of this page.
Also make sure to share your experiences with your study groups about setting up a localhost. If you still have not joined with a study group, you can do so by clicking on the study group icon on the bar at the top in this page.
© Universitat Pompeu Fabra