Skip to content

Quake 2 MD2 Model Loader

by Thomas on June 7th, 2002

Well, we failed to beat Senegal, but since France drawed against Uruguay we still have a pretty good position in the group.
I’ve uploaded the source code to my MD2 model loader, it supports:

  • Loading of .md2 files
  • Texturing of the models
  • Smooth animation using linear interpolation across keyframes

Besides from that it integrates nicely to my scene graph library which I will release when It’s more mature.I agree on the fact that making an MD2 loader is a fairly easy task, I did it mainly to test my lib and I was tired of testing with simple primitives only :) (yeah yeah, I know that the models is built of triangles which is simple but you get my point!). If I were to continue working on the MD2 loader I might consider supporting tristrips and trifans since I would speed up rendering a great deal.
Anyways, the source is four files in total,

  • ThMD2Object.cpp: The actual loader, it is a class derived from a generic “Geometry” class in my scene graph.
  • ThMD2Object.h: The header file for the loader class, contains the struct for the MD2 file as well. The rendering code is seperated from the actual MD2 object to allow me to code several different renderes based on different API’s, for now I’ve only coded a bit of the Glut/OpenGL renderer, but you should be able to derive from my virtual “Renderer” class and code the MD2 renderer yourself.
  • ThGlutRenderer.cpp:The code responsible for the rendering of the model (and other varius things, except for the MD2 code it is mostly incomplete).
  • ThGlutRenderer.h: Header file for the renderer.

From → Development, Imported

One Comment
  1. junkwangha permalink

    i want md2 loader

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS