Jump to content
  • Advertisement
Sign in to follow this  

Loading MD3 In DirectX

This topic is 4871 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

I got this tutorial from http://www.gametutorials.com .

It's in OpenGL, but that shouldn't matter much, as this is actually showing how to load the data, and not really use the API.

Hope this helps, here's a direct link: http://www.gametutorials.com/gtstore/pc-76-1-md3-file-loader.aspx

Share this post

Link to post
Share on other sites
Hey thanks.

Actually I've looked at this and ran into the problem since for OGL it was able to use indexed texture coordinates. I wasn't wonder if anything out there that dealt with the situation.

Share this post

Link to post
Share on other sites

If you're just having problems with coordinates you can either:
1.) Swizzle .yz coordinates (x,y,z / x,z,y / x,-z,y etc...) once it is ok... or
2.) Use the left to right or vice versa conversion matrix:
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1

Transform any GL vertex and you get a DX vertex or vice versa.

If you're having problems organizing FVF buffers, there is no work arround, the simplest thing would be to create a vertex buffer with 3xNUMFACES of vertices and just draw it NON Indexed. You can forget HW acceleration at the beggining and just focus with correct structures with the DrawPrimitiveUP function. DrawPrimitiveUP does not even require that there has to be a vertex buffer, it just takes whatever you pass to it, for example:

struct TVertex{
float x,y,z;
float u,v;

TVertex* pVertices = new TVertex[numFaces*3];
device->SetFVF(D3DFVF_XYZ | D3DTEX1);
delete [] pVertices;

Once it works, you can re-arange it with to INDEXED DrawIndexedPrimitveUP and after that just change DrawPrimitveUp to DrawIndexedPrimitive and you're in hardware. Of course you will have to copy your "pVertices" to a vretex buffer. But you should mess around with that after you at least rendered your mesh.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!