This preliminary project will get you started with the course, and has four parts. First, you'll make sure that your machine is set up with the infrastructure you need, including using either a text editor or an IDE to edit JavaScript, configuring your web browser to access local JavaScript files, version control (for example with git). You'll also want to check out the basics of JavaScript if you haven't used it before. Second, you'll get started with running an example WebGL/JavaScript program and making a few simple changes to it, and learning how to use your browser's JavaScript debugger to inspect and change the running program. Third, you will also read the academic conduct guidelines for the course and certify that you understand them. Fourth, you'll set up and test the handin command.
This preliminary "Project 0" is mandatory but not marked; we will not mark your Project 1 until we see that p0 has been handed in as required below.
It's up to you whether to use your own laptop or the lab machines in CS Room 005. We recommend making sure that you can work on both platforms.You will need to edit Javascript and HTML files on your machine. You have two choices: a standard text editor, or an IDE (Integrated Development Environment) like Eclipse.
We recommend using either Chrome or Firefox. You may run into compatability problems with Safari or Internet Explorer.
Since JavaScript is typically sent from a server, by default most web browsers do not allow accessing JavaScript files stored on your local computer, for security reasons. However, while you are developing WebGL/JS in this course, you will find it very useful to be able to access local files, for example JavaScript libraries! There are two solutions.
Quickly grab the code for this project.The easiest option, which we recommend, is to simply enable your browser to run local JavaScript. On Chrome in Linux, you will need to start the program with the command-line flag google-chrome --allow-file-access-from-files. On Mac OS quit Chrome and use the command
open -a "Google Chrome" --args --allow-file-access-from-files. Here are several pages with instructions on how to enable local file access:
The alternative solution is to install and run a web server on your computer, such as WAMP or LAMP.
We strongly recommend that you use version control. It's particularly crucial for teams, but it's highly desireable even if you're working individually. We recommend git, but you are welcome to use another package if you prefer.
You will need to familiarize yourself with the basic syntax of JavaScript.
The example code PO Webgl-Sandbox uses Physijs, which is a wrapper for the ammo.js project, which is a port of the Bullet physics library.
git clone https://Glen_B@bitbucket.org/Glen_B/webgl-learning.git
This HTML file loads the JavaScript file examples/vehicle.js file that is loaded by examples/vehicle.html.
If you're using Eclipse, start it up and import the project. If you're using a text editor, load the file into it. Just reload the page in the browser to see the results of your edits.
The debuggers in both Chrome and Firefox have very similar capabilities:
Try using the debugger built into your browser to do each of these operations:
There are three primary code changes that you should make in example/vehicle.js. Search for the string "CHANGE", which marks the locations in the code where you should make your edits.
Take a screenshot of the browser window after you have changed the number of boxes in the simulation. Use the built-in capabilities of your operating system (Linux, Mac, or Windows). Your screenshot should be in PNG format. Instructions:
You will now set up and test the process of handing in your project using the handin command.
handin cs314 p0You do not need to be in any particular directory to run this command; handin will automatically use the contents of ~/cs314/p0 no matter what directory you are in when you run it.