Loading an animated MD2 file (min3D framework for Android)

Posted by on May 25, 2010 in 3D, Android11 comments

NOTE: This OpenGL ES 1.1 framework isn’t maintained anymore. Check out the OpenGL ES 2.0 Rajawali framework which also supports live wallpapers.

I just updated min3D for Android with an MD2 file importer.  MD2 is a format that was developed by ID Software and originally used for Quake II and other games. MD2 can be used for static models but the main reason for using it is animation.

Min3D is now able to import 3 different filetypes:

This is what the code looks like. Check out the min3D sample application to see it running:

package min3d.sampleProject1;

import min3d.animation.AnimationObject3d;
import min3d.core.RendererActivity;
import min3d.parser.IParser;
import min3d.parser.Parser;

public class ExampleLoadMD2File extends RendererActivity {
	private AnimationObject3d ogre;
	public void initScene() {
		IParser parser = Parser.createParser(Parser.Type.MD2,
				getResources(), "min3d.sampleProject1:raw/ogro");

		ogre = parser.getParsedAnimationObject();
		ogre.scale().x = ogre.scale().y = ogre.scale().z = .07f;
		ogre.rotation().z = -90;
		ogre.rotation().x = -90;

	public void updateScene() {



Here’s the result (click the image to see the youtube video):

Please note that it looks MUCH better on the phone.

Please note that it looks MUCH better on a handset.

Tags: , , , , , ,


» Comments RSS Feed
  1. Awesome, looks very useful. Do you think it’s practical to use your min3d to program a 3d game as it is now?

  2. I cannot load MD2 file using the code above.
    Is Your MD2 file in demo export from Blender?

  3. Very good your tutorial, thanks to him I’m using min3d md2 models in my project on Android, but do not know how can I detect which object in the User touched, I am tempted to onTouchEvent event but can not identify which model he selected on the screen, you know how I do it? sorry my English is bad.Any help is welcome thank you …

  4. Any easy way to export from 3d Max to md2?


  5. Hi, example works great! I have one question, do you have to call parse on each initScene()? It can take a while to load file, I would rather remember state on pause/resume in member variable than to load from file each time.

    I tried keeping “ogre” object and adding it to scene on next init, but textures get lost during reset. Do you have some example of applying textures manually? I can solve it, but I would prefer to do it without changing your code.
    Thanks, Vladimir

  6. hello,, can you give me any hint how to link the skin files for .MD2 files?
    i use plugin for 3ds max and its only produce .pcx or .bmp for the skin file,
    i can load the model and animation,
    but the skin didnt loaded…

  7. [...] http://code.google.com/p/min3d/ http://www.rozengain.com/blog/2010/05/25/loading-an-animated-md2-file-min3d-framework-for-android/ [...]

  8. [...] http://www.rozengain.com/blog/2010/05/25/loading-an-animated-md2-file-min3d-framework-for-android/ [...]

  9. i can’t to loat.. help me !!

    can you gif the project for this example


    salam indonesia

  10. Check https://github.com/MasDennis/RajawaliExamples/blob/master/src/com/monyetmabuk/rajawali/tutorials/RajawaliMD2Renderer.java

  11. The Texture does not load here… the monster is just white… with out tesxturing any idea why?

Leave a comment