Archived

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

+AA_970+

rendering md2 files as triangle strips

Recommended Posts

MD2''s are rendered as a collection of triangle strips and fans.

By working through the data held in the "GL_COMMANDLIST", you''ll construct a series of triangle strips/fans to render.

The X,Y,Z of each vertex is "compressed" down to one byte each, and each frame has unique scale and translate values that have to be applied to each vertex to turn them into their actual values.

The CommandList is just a series of float and integer value groups. For each group the first value denotes whether you should be constructing a triangle strip or a fan and how many vertices it contains. (-7) means make a triangle fan from the next seven commands, (+7) means make a triangle strip from the next seven commands. The next seven commands would then comprise of the actual tu,tv texture coordinate (floats) and the VertexIndex. If you''ve already transformed the vertices for the current frame, TransformedVertices[VertexIndex] would provide the correct X,Y,Z.

I found this document pretty useful. (In fact I was able to write all my MD2 code from it).

If you are using DirectX you''re welcome to my md2 classes if you want them.

Cheers

Matt



Share this post


Link to post
Share on other sites