   meshes and direct3d9
  Hi, im trying to load meshes .x with direct3d9, im using a class to do it, take from davesprogramming.com   class Mesh{public:void Draw(void);bool Load(char *filename);private:LPD3DXBUFFERpD3DXMtrlBuffer;LPD3DXBUFFERpAdjacencyBuffer;LPD3DXMESHg_pMesh;D3DMATERIAL9*g_pMeshMaterials;LPDIRECT3DTEXTURE9*g_pMeshTextures;DWORDg_dwNumMaterials;};the two functions are so defined   void Mesh::Draw(void){    for( DWORD i=0; i<g_dwNumMaterials; i++ ){g_d3d_device->SetMaterial( &g_pMeshMaterials[i] );g_d3d_device->SetTexture( 0, g_pMeshTextures[i] );g_pMesh->DrawSubset( i );}}bool Mesh::Load(char *filename){   g_pMesh= NULL;   g_pMeshMaterials= NULL; g_pMeshTextures= NULL; g_dwNumMaterials= 0;if( FAILED( D3DXLoadMeshFromX( filename,D3DXMESH_VB_WRITEONLY|D3DXMESH_MANAGED,NULL, &pD3DXMtrlBuffer, &pAdjacencyBuffer,    &g_dwNumMaterials, &g_pMesh ) ) )    {return false;   }   D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer();g_pMeshMaterials = new D3DMATERIAL9[g_dwNumMaterials];g_pMeshTextures  = new LPDIRECT3DTEXTURE9[g_dwNumMaterials];    for( DWORD i=0; i<g_dwNumMaterials; i++ )    {   g_pMeshMaterials[i] = d3dxMaterials[i].MatD3D;g_pMeshMaterials[i].Power = 10;   if( FAILED( D3DXCreateTextureFromFile( g_d3d_device,    d3dxMaterials[i].pTextureFilename,   &g_pMeshTextures[i] ) ) )   {  g_pMeshTextures[i] = NULL;   }    }   pD3DXMtrlBuffer->Release();return true;}the problem is that the function   if( FAILED( D3DXLoadMeshFromX( filename,D3DXMESH_VB_WRITEONLY|D3DXMESH_MANAGED,NULL, &pD3DXMtrlBuffer, &pAdjacencyBuffer,    &g_dwNumMaterials, &g_pMesh ) ) )    {return false;   }always returns false and i dont understand why...could someone tell me why ThanksKev 
  Use DXTrace to find out what the Error is#include <dxerr9.h>#pragma comment (lib, "dxerr9.lib") //Or add it to your project settings if you''re that way inclinedthen goHRESULT hr;if (FAILED(hr = DXSomeFunction())){DXTrace(__FILE__, __LINE__, hr, "DXSomeFunction failed", false);return false;}look it up in the SDK, it''s worth it''s weight in small coconuts ;  Make sure you''re using the Debug Runtime (Control Panel->DirectX.  Then go to the Direct3D tab).  Crank up the Debug Output Level.  With that done, check to see what the debug spew says (it should tell you why the function failed).neneboricua 