Messing with OpenGL (well, WebGL really) again, it is nice and fast, but it's a bugger to get all the bits lined up right.

Roughly:

  • Objects are made of triangles
  • Triangles are made from vertexes (vertices, but no one says that)
  • One can load a bunch of data up to the GPU, and it stays there. I think this is a Virtual Buffer Object (VBO)
  • Drawing is getting everything set up, then calling 'draw' (Imagine a huge panel with switches, sliders, dials, and a big red button. Toggle the switches, set the dials and sliders, and then press the button. A printer in the corner busts into life.)
  • WebGL doesn't know anything about frames, one just lines up the data, calls draw, and then calls clear when it's time to start the next frame
  • There's a bunch of stuff (model/view/perspective transforms, lighting, shading) that's nearly standard, but not really.

I've implemented diamond- square (whoop!), and the GPU is drawing triangles (double whoop!), I want to get lighting/shading next (Husband says use cross product to get normals, i.e., at any given triangle corner, get the vectors to the other corners and the normal is the cross of that), and then start on camera movement.

I'm starting to get pictures in my head of flying close to the ground around tree covered mountains. This could be really quite cool.


Medium term choices include:

  • scale factor: How big is a heightmap pixel relative to (e.g.) trees, or the camera viewpoint.

  • An I going to actually draw the torus, or am I going to cheat and just draw cpoies at the edge of the map.

    I really like the idea of the torus, and hopefully the transform isn't that expensive (I think it might just be a matrix multiplication, but there's probably trig in there somewhere).

Anyway. Sleepy time, g'd night fair reader.


To remember your current position in the blog, this page must store some data in this browser.

Are you OK with that?