MD2 Loader

Started by
11 comments, last by VitaliBR 13 years, 9 months ago
Hi!

I tried using the following code to load an md2 model, but the collection of several errors.
http://www.flipcode.com/archives/MD2_Model_Loader.shtml

I wonder where I can find a code ready to load md2.

Thanks
http://mateusvitali.wordpress.com/
Advertisement
This doesn't exactly answer your question but... Md2 is a very old format. You would be better off choosing a more modern animation format. Md3 or Md5 would be a better start as you will more likely find tools that work with modern 3d applications.

Quote:I wonder where I can find a code ready to load md2.


Don't be so lazy. What errors do you get with the code?
The definitive MD2 loading code can be found here: ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

Assimp reads MD2 as well (amongst many other formats), but it does not currently support vertex animations. If you don't need those, it might be useful for you.
Quote:Original post by mhagain
The definitive MD2 loading code can be found here: ftp://ftp.idsoftware.com/idstuff/source/q2source-3.21.zip


Theoretically yes.

In modern terms, not really. The quake 2 source is from 1998 and is game code. There are lots of nasty hacks in the source, very very nasty hacks in modern terms. I wouldn't expect to see C++ code like this in any project this decade!

Ok

I do not know how to make a loader,
if I choose the MD3 or MD5
as I do? where do I start?
http://mateusvitali.wordpress.com/
http://tfc.duke.free.fr/coding/md5-specs-en.html

Although I'd recommend building your own format around what you need.

For instance Md5 is a good format for CPU based animation, but the amount of data require means it is terra-bad on the gpu.
I've got some MD2 loading code if you want it, wrapped up in a C++ class. One caveat though: it only loads 1 animation frame in the mesh (the 1st) since that all I needed for the game were static models.

It's not a huge job however to extend it to load the other frames- just add a for loop and read one frame at a time.

Download the source code for 'Rogue Trader' and check out the 'MD2Mesh' class and 'MD2Mesh.h':

http://www.darraghcoy.com

Let me know if you have any questions about it.
Thanks Darragh :)

I'll look at your code,
any questions post here
http://mateusvitali.wordpress.com/
as to create its own model.

How should begin to study?
http://mateusvitali.wordpress.com/

This topic is closed to new replies.

Advertisement