HTML5 Canvas MD2 Renderer

Posted by

Hot on the heels of my PHP MD2 renderer that loads a Quake II MD2 model file and renders and rotates the model in 3D, I decided that it was clunky and to take advantage of new techniques in browsers

This is an HTML5 based Quake II MD2 model loader and renderer that I wrote to demonstrate file reading and canvases.

Your browser doesn’t support canvas.

Notes

I used the BinaryReader which was refactored by Vjeux although I had to slightly refactor it myself as I had problems getting floats to read properly. I quickly wrote my own function for calculating the IEE 754 Single precision floats rather than modify the function as doing it from scratch was quicker in the end, either way, it gave me the result I was after.

I also made use of the MD2 file format specification document by David Henry because I’m nowhere near smart enough to remember the headers every time I do an MD2 reader 🙂

This demo will not work in Internet Explorer 8 or less. Use Chrome, Firefox, Safari or Opera. They are all far better choices.

Terry Butler