Advertisement Jump to content


This topic is now archived and is closed to further replies.


Loading MD2 files header

This topic is 6175 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I am working on loading a md2 file in my window. I want to do this for many programs and i want to write a header file that will load the model so i can just call the function in the main program loop. Any suggestions on doing this (should i make a class or just a custom function?) programguy

Share this post

Link to post
Share on other sites
I''d write a class that way you don''t have to worry about keeping all the structs in order. If you wanted to have more model in the program doing it without a class would be a lot harder.

Also you can always override aspects of classes if you need to make a minor modification to the code for one model.

Just make sure you don''t make any program specific calls from inside the class.

Share this post

Link to post
Share on other sites
I wrote this code a while back, modified a DX7 version for DX8 and added the vertex normal table and calculations to get lighting. Credit where credit is due, thanks to William Chin for the original code :

class CMD2
BOOL LoadMD2Model( MD2MODEL *model, char *filename );
BOOL RenderMD2Model( LPDIRECT3DDEVICE8 m_pd3dDevice,
float wx, float wy, float wz, float rotation_angle,
void ReleaseMD2Model( MD2MODEL *model );

So you just call RenderMD2Model() in each render loop of your program.

Hope this helps,


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!