   MD2 Texturing Problem
  Hey,My MD2 model isn't texturing properly. You can download the exe and source MD2 problem.Dont mind the memory allocation mess, I can get quite messy when figuring things out ;)My CPP file// UltraLight_MD2_Load_Save.cpp : Defines the entry point for the DLL application.//#include "UltraLight_MD2_Load_Save.h"BOOL APIENTRY DllMain( HANDLE hModule,    DWORD  ul_reason_for_call,    LPVOID lpReserved ){    return TRUE;}//===========================================================================================\\// this is the main method that actaully creates the pluginextern "C" {UL_PLUGIN IPlugin* CreatePlugin( void* ){return new CUltraLight_MD2_Load_Save( );} // end CreatePlugin}; // end extern "C"//===========================================================================================\\/*********************************************************************************************/////CLASS: CMeshPlugin////DESC: This is a mesh loader/saver///*********************************************************************************************/// this returns the plugins ID// it takes nothing// it returns the plugins IDchar* CMeshPlugin::GetID( void ){return PLUGID_MESH;} // end CMeshPlugin::GetID// this runs the plugin// it takes the nessercary data// it retruns the nessercary datavoid* CMeshPlugin::Run( void* pData ) {// do noting... ;)return 0;} // end CMeshPlugin::Run// this returns a new instance of the plugin if needed// it takes nothing// it returns the plugin instancevoid* CMeshPlugin::CreateInstance( void ){return new CUltraLight_MD2_Load_Save;} // end CMeshPlugin::CreateInstance/*********************************************************************************************/////CLASS: CUltraLight_MD2_Load_Save////DESC: This is a md2 model loader/saver///*********************************************************************************************/// this loads the md2 model file// it takes the filename of the file to open// it returns true upon success else returns falsebool CUltraLight_MD2_Load_Save::Load( const char* strFName ){// load in the modelm_pModel = LoadMD2( (char *const)strFName, "" );if ( !m_pModel )return false;return true;} // end CUltraLight_MD2_Load_Save::Load// this loads the md2 model file// it takes the filename of the file to save// it returns true upon success else returns falsebool CUltraLight_MD2_Load_Save::Save( const char* strFName ){return true;} // end CUltraLight_MD2_Load_Save::Save// this returns the extension of this file format, .md2// it takes nothing// it returns the extension of this file formatchar* CUltraLight_MD2_Load_Save::GetExt( void ){return "md2";} // end CUltraLight_MD2_Load_Save::GetExt// this returns the animation typeeMeshAnimTypes CUltraLight_MD2_Load_Save::GetAnimationType( void ){return eKeyFrame;} // end CUltraLight_MD2_Load_Save::GetAnimationType// these return the mesh data// they take noting// they return the mesh dataLPVERTEX CUltraLight_MD2_Load_Save::GetVertexs( void ){return m_pModel->m_pVerts;} // end CUltraLight_MD2_Load_Save::GetVertexs// this takes the animation to returnLPKEYFRAMEANIMATION CUltraLight_MD2_Load_Save::GetAnimation( int nFrame ){return &m_pModel->m_Anim;} // end CUltraLight_MD2_Load_Save::GetKeyFrameint CUltraLight_MD2_Load_Save::GetNumAnimations( void ){return 1;} // end CUltraLight_MD2_Load_Save::GetNumKeyFramesunsigned long CUltraLight_MD2_Load_Save::GetNumVertexs( void ){return m_pModel->m_nNumTriangles*3;} // end CUltraLight_MD2_Load_Save::GetNumVertexsunsigned short* CUltraLight_MD2_Load_Save::GetVertexIndex( void ){return m_pModel->m_psVertIndex;} // end CUltraLight_MD2_Load_Save::GetVertexIndexunsigned long CUltraLight_MD2_Load_Save::GetNumVertexsIndex( void ){return m_pModel->m_nNumTriangles*3;} // end CUltraLight_MD2_Load_Save::GetNumVertexsIndexunsigned long CUltraLight_MD2_Load_Save::GetNumTriangles( void ){return m_pModel->m_nNumTriangles;} // end CUltraLight_MD2_Load_Save::GetNumTrianglesCVector3 CUltraLight_MD2_Load_Save::GetPos( void ){return CVector3( );} // end CUltraLight_MD2_Load_Save::GetPosCVector3 CUltraLight_MD2_Load_Save::GetRot( void ){return CVector3( );} // end CUltraLight_MD2_Load_Save::GetRotCVector3 CUltraLight_MD2_Load_Save::GetScale( void ){return CVector3( 1,1,1 );} // end CUltraLight_MD2_Load_Save::GetScale//===========================================================================================\\// this loads the md2 model// it takes the filename of the md2 model to load and the filename(s) of the skins to load// it returns the loaded model upon success else returns NULLLPMD2 LoadMD2( char *const strFName, char *const strFTexName ){FILE* fp;int nFileLen;char *pBuff;LPMD2 pModel;LPMD2HEADER pModelHeader;LPMD2FRAME pFrame;LPVERTEX pVecList;unsigned short *psVertIndex, *psTexIndex, *psBufIndex, *index;LPMD2TEXCOORDINDEX pTexIndex;LPMD2TRIANGLE pTri, pTriBuff;// open the filefp = fopen( strFName, "rb" );if ( !fp )return NULL;// find the length of the filefseek( fp, 0, SEEK_END );nFileLen = ftell( fp );fseek( fp, 0, SEEK_SET );// read the entire file into the bufferpBuff = (char*)malloc( sizeof( char ) * ( nFileLen + 1 ) );if ( !pBuff )return NULL;fread( pBuff, sizeof( char ), nFileLen, fp );// extract the model headerpModelHeader = (LPMD2HEADER)pBuff;// create model memorypModel = (LPMD2)malloc( sizeof( MD2 ) );if ( !pModel )return NULL;// create vertex memorypModel->m_pVerts = (LPVERTEX)malloc( sizeof( VERTEX ) * pModelHeader->m_nNumTris * 3 * pModelHeader->m_nNumFrames );if ( !pModel->m_pVerts )return false;pTri = (LPMD2TRIANGLE)malloc( sizeof( MD2TRIANGLE ) * pModelHeader->m_nNumTris * pModelHeader->m_nNumFrames );if ( !pModel->m_pVerts )return false;// set member vars.pModel->m_nNumPoints = pModelHeader->m_nNumXYZ;pModel->m_nNumST= pModelHeader->m_nNumST;pModel->m_nNumFrames = pModelHeader->m_nNumFrames;pModel->m_nFrameSize = pModelHeader->m_nFrameSize;// setup the animationpModel->m_Anim.m_Frames.Init( pModel->m_nNumFrames );pModel->m_Anim.m_nNumKeyFrames = pModel->m_nNumFrames;pModel->m_Anim.m_nCurrentKeyFrame = 0;pModel->m_Anim.m_fIntroperlate = 0.0f;// compute all of the models vertsfor ( int n = 0; n < pModel->m_nNumFrames; n++ ) {pFrame = (LPMD2FRAME)&pBuff[ pModelHeader->m_nOffsetFrames + pModelHeader->m_nFrameSize * n ];// calculate the vert positions based on the frame detailsint nNumXYZ = pModelHeader->m_nNumXYZ;pVecList = (LPVERTEX)&pModel->m_pVerts[ pModelHeader->m_nNumXYZ * n ];for ( int i = 0; i < nNumXYZ; i++ ){pVecList.x = pFrame-&gt;m_fScale[ <span class="cpp-number">0</span> ] * pFrame-&gt;m_fp.v[ <span class="cpp-number">0</span> ] + pFrame-&gt;m_fTranslate[ <span class="cpp-number">0</span> ];pVecList.y = pFrame-&gt;m_fScale[ <span class="cpp-number">1</span> ] * pFrame-&gt;m_fp.v[ <span class="cpp-number">1</span> ] + pFrame-&gt;m_fTranslate[ <span class="cpp-number">1</span> ];pVecList.z = pFrame-&gt;m_fScale[ <span class="cpp-number">2</span> ] * pFrame-&gt;m_fp.v[ <span class="cpp-number">2</span> ] + pFrame-&gt;m_fTranslate[ <span class="cpp-number">2</span> ];} <span class="cpp-comment">// end for</span><span class="cpp-comment">//pModel-&gt;m_Anim.m_Frames[ n ].m_pVerts = pVecList; // set the verts</span>} <span class="cpp-comment">// end for</span><span class="cpp-comment">// load in the verts</span><span class="cpp-comment">// create the vert memory</span>index = (<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span>*)malloc( <span class="cpp-keyword">sizeof</span>( <span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span> ) * pModelHeader-&gt;m_nNumTris * <span class="cpp-number">3</span> );<span class="cpp-comment">// set the number of tris</span>pModel-&gt;m_nNumTriangles = pModelHeader-&gt;m_nNumTris;pModel-&gt;m_psVertIndex = index;<span class="cpp-comment">// point to the tri indecies in the buff</span>pTriBuff = (LPMD2TRIANGLE)&amp;pBuff[ pModelHeader-&gt;m_nOffsetTris ];<span class="cpp-comment">// point to the texture coords</span>pTexIndex = (LPMD2TEXCOORDINDEX)&amp;pBuff[ pModelHeader-&gt;m_nOffsetST ];<span class="cpp-comment">// set the mesh</span><span class="cpp-keyword">int</span> nNumTris = pModelHeader-&gt;m_nNumTris;<span class="cpp-comment">// calculate the normals and set the texture coords</span><span class="cpp-keyword">for</span> ( <span class="cpp-keyword">int</span> x = <span class="cpp-number">0</span>; x &lt; pModel-&gt;m_nNumFrames; x++ ) {pVecList = (LPVERTEX)&amp;pModel-&gt;m_pVerts[ pModelHeader-&gt;m_nNumXYZ * x ];pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts = <span class="cpp-keyword">new</span> VERTEX[ pModelHeader-&gt;m_nNumTris * <span class="cpp-number">3</span> ];pModel-&gt;m_Anim.m_Frames[ x ].m_fTime = <span class="cpp-number">0</span>.05f;pModel-&gt;m_Anim.m_Frames[ x ].m_nNumVerts = pModelHeader-&gt;m_nNumTris * <span class="cpp-number">3</span>;<span class="cpp-keyword">for</span> ( <span class="cpp-keyword">int</span> i = <span class="cpp-number">0</span>, j = <span class="cpp-number">0</span>, t = <span class="cpp-number">0</span>; i &lt; nNumTris; i++, j += <span class="cpp-number">3</span> ){<span class="cpp-comment">// save the texture coord</span>pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">0</span> ].x = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">0</span> ] ].x;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">0</span> ].y = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">0</span> ] ].y;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">0</span> ].z = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">0</span> ] ].z;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">0</span> ].u1 = pTexIndex[ pTriBuff.m_nTexIndicies[ <span class="cpp-number">0</span> ] ].s;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">0</span> ].v1 = pTexIndex[ pTriBuff.m_nTexIndicies[ <span class="cpp-number">0</span> ] ].t;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">1</span> ].x = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">1</span> ] ].x;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">1</span> ].y = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">1</span> ] ].y;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">1</span> ].z = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">1</span> ] ].z;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">1</span> ].u1 = pTexIndex[ pTriBuff.m_nTexIndicies[ <span class="cpp-number">1</span> ] ].s;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">1</span> ].v1 = pTexIndex[ pTriBuff.m_nTexIndicies[ <span class="cpp-number">1</span> ] ].t;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">2</span> ].x = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">2</span> ] ].x;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">2</span> ].y = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">2</span> ] ].y;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">2</span> ].z = pVecList[ pTriBuff.m_nVertIndicies[ <span class="cpp-number">2</span> ] ].z;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">2</span> ].u1 = pTexIndex[ pTriBuff.m_nTexIndicies[ <span class="cpp-number">2</span> ] ].s;pModel-&gt;m_Anim.m_Frames[ x ].m_pVerts[ j+<span class="cpp-number">2</span> ].v1 = pTexIndex[ pTriBuff.m_nTexIndicies[ <span class="cpp-number">2</span> ] ].t;<span class="cpp-comment">// set the new index buffer</span>index[ j+<span class="cpp-number">0</span> ] = j+<span class="cpp-number">0</span>;index[ j+<span class="cpp-number">1</span> ] = j+<span class="cpp-number">1</span>;index[ j+<span class="cpp-number">2</span> ] = j+<span class="cpp-number">2</span>;<span class="cpp-comment">/*Tri.m_nVertIndicies[ 0 ]pVecList[ psVertIndex[ j+0 ] ].u1 = pTexIndex[ psTexIndex[ j+0 ] ].s;pVecList[ psVertIndex[ j+0 ] ].v1 = pTexIndex[ psTexIndex[ j+0 ] ].t;pVecList[ psVertIndex[ j+1 ] ].u1 = pTexIndex[ psTexIndex[ j+1 ] ].s;pVecList[ psVertIndex[ j+1 ] ].v1 = pTexIndex[ psTexIndex[ j+1 ] ].t;pVecList[ psVertIndex[ j+2 ] ].u1 = pTexIndex[ psTexIndex[ j+2 ] ].s;pVecList[ psVertIndex[ j+2 ] ].v1 = pTexIndex[ psTexIndex[ j+2 ] ].t;*/</span>} <span class="cpp-comment">// end for</span><span class="cpp-comment">//pModel-&gt;m_Anim.m_Frames[ n ].m_pVerts = pVecList; // set the verts</span>} <span class="cpp-comment">// end for</span><span class="cpp-comment">// finish up</span>fclose( fp );fflush( fp );<span class="cpp-comment">//free( psTexIndex );</span><span class="cpp-comment">//free( psVertIndex );</span>free( pBuff );<span class="cpp-keyword">return</span> pModel;} <span class="cpp-comment">// end LoadMD2</span></pre></div><!–ENDSCRIPT–>My H file<!–STARTSCRIPT–><!–source lang="cpp"–><div class="source"><pre><span class="cpp-comment">// FILE: UltraLight_MD2_Load_Save.h by Richard Hughes. 10/07/2004</span><span class="cpp-comment">//</span><span class="cpp-comment">// DESC: This defnes all the needed classes etc… to allow the UltraLight(r) game engine to load and save</span><span class="cpp-comment">//  .md2 model files</span><span class="cpp-directive">#ifndef</span> UltraLight_MD2_Load_Save<span class="cpp-directive">#define</span> UltraLight_MD2_Load_Save<span class="cpp-comment">// INCLUDES</span><span class="cpp-directive">#include</span> <span class="cpp-literal">"..\\..\\UltraLight\\UltraLight\\MeshPlugin.h"</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2Vec</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is a simple vector to be used with the loading and saving of the md2 model</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2Vec {<span class="cpp-keyword">float</span> x,y,z;}MD2VEC, *LPMD2VEC;<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2TexCoordIndex</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is a simple tex coord index obj. to be used with the loading and saving of the md2 model</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2TexCoordIndex {<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span> s,t;}MD2TEXCOORDINDEX, *LPMD2TEXCOORDINDEX;<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2FramePoint</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is a md2 framepoint</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2FramePoint {<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">char</span> v[ <span class="cpp-number">3</span> ];<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">char</span> m_cNormalIndex;}MD2FRAMEPOINT, *LPMD2FRAMEPOINT;<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2Frame</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is a md2 frame</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2Frame {<span class="cpp-keyword">float</span> m_fScale[ <span class="cpp-number">3</span> ];<span class="cpp-keyword">float</span> m_fTranslate[ <span class="cpp-number">3</span> ];<span class="cpp-keyword">char</span>  m_strName[ <span class="cpp-number">16</span> ];MD2FRAMEPOINT m_fp[ <span class="cpp-number">1</span> ];}MD2FRAME, *LPMD2FRAME;<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2Triangle</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is an md2 triangle</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2Triangle {<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span> m_nVertIndicies[ <span class="cpp-number">3</span> ];<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span> m_nTexIndicies[ <span class="cpp-number">3</span> ];}MD2TRIANGLE, *LPMD2TRIANGLE;<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2Header</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is the md2 model header</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2Header {<span class="cpp-keyword">int</span> m_nIdent;<span class="cpp-keyword">int</span> m_nVersion;<span class="cpp-keyword">int</span> m_nSkinWidth;<span class="cpp-keyword">int</span> m_nSkinHeight;<span class="cpp-keyword">int</span> m_nFrameSize;<span class="cpp-keyword">int</span> m_nNumSkins;<span class="cpp-keyword">int</span> m_nNumXYZ;<span class="cpp-keyword">int</span> m_nNumST;<span class="cpp-keyword">int</span> m_nNumTris;<span class="cpp-keyword">int</span> m_nNumGLCommands;<span class="cpp-keyword">int</span> m_nNumFrames;<span class="cpp-keyword">int</span> m_nOffsetSkins;<span class="cpp-keyword">int</span> m_nOffsetST;<span class="cpp-keyword">int</span> m_nOffsetTris;<span class="cpp-keyword">int</span> m_nOffsetFrames;<span class="cpp-keyword">int</span> m_nOffsetGLCommands;<span class="cpp-keyword">int</span> m_nOffsetEnd;}MD2HEADER, *LPMD2HEADER;<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//STRUCT: tagMD2</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is the md2 model</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">typedef</span> <span class="cpp-keyword">struct</span> tagMD2 {<span class="cpp-keyword">int</span> m_nNumFrames;<span class="cpp-keyword">int</span> m_nNumPoints;<span class="cpp-keyword">int</span> m_nNumTriangles;<span class="cpp-keyword">int</span> m_nNumST;<span class="cpp-keyword">int</span> m_nFrameSize;<span class="cpp-keyword">int</span> m_nTexWidth, m_nTexHeight;<span class="cpp-keyword">int</span> m_nCurrentFrame;<span class="cpp-keyword">float</span> m_fInterpole;<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span> *m_psTexIndex;<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span> *m_psVertIndex;LPVERTEX m_pVerts;KEYFRAMEANIMATION m_Anim;}MD2, *LPMD2;<span class="cpp-comment">// this loads the md2 model</span><span class="cpp-comment">// it takes the filename of the md2 model to load and the filename(s) of the skins to load</span><span class="cpp-comment">// it returns the loaded model upon success else returns NULL</span>LPMD2 LoadMD2( <span class="cpp-keyword">char</span> *<span class="cpp-keyword">const</span> strFName, <span class="cpp-keyword">char</span> *<span class="cpp-keyword">const</span> strFTexName );<span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-comment">//</span><span class="cpp-comment">//CLASS: CUltraLight_MD2_Load_Save</span><span class="cpp-comment">//</span><span class="cpp-comment">//DESC: This is a md2 model loader/saver</span><span class="cpp-comment">//</span><span class="cpp-comment">/*********************************************************************************************/</span><span class="cpp-keyword">class</span> CUltraLight_MD2_Load_Save : <span class="cpp-keyword">public</span> CMeshPlugin {LPMD2 m_pModel;<span class="cpp-keyword">public</span>:CUltraLight_MD2_Load_Save( <span class="cpp-keyword">void</span> ): m_pModel( NULL ){}~CUltraLight_MD2_Load_Save( <span class="cpp-keyword">void</span> ){}<span class="cpp-comment">// this loads the md2 model file</span><span class="cpp-keyword">bool</span> Load( <span class="cpp-keyword">const</span> <span class="cpp-keyword">char</span>* strFName );<span class="cpp-comment">// this saves the md2 model file</span><span class="cpp-keyword">bool</span> Save( <span class="cpp-keyword">const</span> <span class="cpp-keyword">char</span>* strFName );<span class="cpp-comment">// this returns the extension of this file format, .md2</span><span class="cpp-keyword">char</span>* GetExt( <span class="cpp-keyword">void</span> );<span class="cpp-comment">// this returns the animation type</span>eMeshAnimTypes GetAnimationType( <span class="cpp-keyword">void</span> );<span class="cpp-comment">// these return the mesh data</span>LPVERTEX GetVertexs( <span class="cpp-keyword">void</span> );LPKEYFRAMEANIMATION GetAnimation( <span class="cpp-keyword">int</span> nFrame );<span class="cpp-keyword">int</span> GetNumAnimations( <span class="cpp-keyword">void</span> );<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">long</span> GetNumVertexs( <span class="cpp-keyword">void</span> );<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">short</span>* GetVertexIndex( <span class="cpp-keyword">void</span> );<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">long</span> GetNumVertexsIndex( <span class="cpp-keyword">void</span> );<span class="cpp-keyword">unsigned</span> <span class="cpp-keyword">long</span> GetNumTriangles( <span class="cpp-keyword">void</span> );CVector3 GetPos( <span class="cpp-keyword">void</span> );CVector3 GetRot( <span class="cpp-keyword">void</span> );CVector3 GetScale( <span class="cpp-keyword">void</span> );QUICK_SIZE;}; <span class="cpp-comment">// end class CUltraLight_MD2_Load_Save</span><span class="cpp-directive">#endif</span> <span class="cpp-comment">/* UltraLight_MD2_Load_Save */</span><span class="cpp-comment">// EOF: UltraLight_MD2_Load_Save.h</span></pre></div><!–ENDSCRIPT–> <!–EDIT–><span class=editedby><!–/EDIT–>[Edited by - rpg_code_master on January 20, 2005 5:19:04 AM]<!–EDIT–></span><!–/EDIT–>
  hi,I think you've got two problems.Firstly try defining your texture coordinates s,t as shorts,not unsigned shorts, i'm not certain about this, and have meant to test it at some point, but its not unfeasable for negative texture coordiantes i guess.Then for loading in your coords you need to divide each by the respective length of the texture dimensions.new_S = (float)m_pTexCoords.s/m_Header.skinWidthnew_T = (float)m_pTexCoords.t/m_Header.skinHieghtornew_T = 1.0-(float)m_pTexCoords.t/m_Header.skinHieghtif the texture is flipped vertically.   ;  Yer, i'm sure that i've divided the tex coords by the widths in the engine. are there any other posible problems?   