CS 315 Homework 5 - WebGL Notes

As an experiment in order to ease the development process for people who are still struggling with the Android emulator, for this assignment you are welcome to develop in an alternate platform: in particular, using WebGL. WebGL is OpenGL ES for the web browser--it's exactly like what we're doing, but loading in an HTML5 Canvas rather than an Android View.

While all of the OpenGL code stays the same (and all the matrix transformations/etc. match), the base language is JavaScript rather than Java. JavaScript has a similar syntax to Java; for our purposes, the main difference is that JavaScript is untyped (you don't declare a variable type when you make a variable). This can make the code harder to read and it's easier for things to go wrong, but otherwise the structure is the same. So if you are comfortable with JavaScript---or would rather be uncomfortable struggling with JavaScript than be uncomfortable struggling with the emulator---you are welcome to use WebGL for this assignment (if so: be sure and let me know how it goes!)

I will be supporting Android development primarily (and use it as examples in class), but am happy to help individually with specific WebGL issues as they come up.

I have thrown together some starter code for getting the teapot model loaded and rendered in WebGL. If you look throgh the code, you'll see it is very similar to the Android renderer, with a few syntactical differences. Note that the WebGL starter code is not as clean or nicely factored as the Android code.

Again, getting this working is up to you; I can offer limited support at this point. My guess is that getting WebGL working (and dealing with JavaScript's quirks) will take about the same amount of time as you would lose waiting on the emulator... but it may feel like you're being more productive and so being more pleasant.

Finally, here are some resources I've cobbled together for working with WebGL: