Some minor retrospective changes

Just so that you know that I’ve not given up on the lessons… I’m slowly but surely putting together the writeup for lesson 16. While working through it (and fixing messy code), I found a couple of things that needed to be changed in all of the previous lessons:

  • As per Marco Di Benedetto’s suggestion, I’ve moved the code that calls gl.viewport from the initGL function to drawScene. As Marco says, this makes it a bit more explicit; it also had the benefit of making it necessary for me to make the width and the height of the canvas available in drawScene, which meant that I could use them explicitly in the call to the perspective function, so now we use a calculated aspect ration parameter value instead of a hard-wired 1.0. This means that you can resize the canvas in the HTML, and things won’t get stretched or squashed. A definite improvement.
  • Roman pointed out in the comments that the glUtils.js file in the lessons has two copies of makeOrtho. This shouldn’t have been causing problems — the second one should just have overwritten the first — but apparently it was stopping stuff from displaying on his machine. I’ve removed it.

So that’s it for now.

You can leave a response, or trackback from your own site.

Leave a Reply

Subscribe to RSS Feed Follow Learning WebGL on Twitter