but my problem, I seem to be able to load a mesh from a file and set it to a mesh function
MYMESH loadMesh(LPCTSTR namet)
{
MYMESH temp;
temp.name=namet;
LPD3DXBUFFER bufShipMaterial;
D3DXLoadMeshFromX(temp.name,
D3DXMESH_SYSTEMMEM,
g_pd3dDevice,
NULL,
&bufShipMaterial,
NULL,
&temp.NumMaterials,
&temp.Mesh);
D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)bufShipMaterial->GetBufferPointer();
temp.mmaterial = D3DMATERIAL9[temp.NumMaterials];
temp.ttexture = LPDIRECT3DTEXTURE9[temp.NumMaterials];
(DWORD i = 0; i < temp.NumMaterials; i++)
{
temp.mmaterial = tempMaterials.MatD3D;
temp.mmaterial.Ambient = temp.mmaterial.Diffuse;
if(FAILED(D3DXCreateTextureFromFileA(g_pd3dDevice,
tempMaterials.pTextureFilename,
&temp.ttexture)))
temp.ttexture = NULL;
return temp;
}
}
and setting it to MYMESH meshy = loadMesh(L"bananas.x"); along those lines,
that seems to work
but my problem is when I try to draw it.
for some reason it doesn't like when I use meshy.Mesh or meshy.NumMaterials it just doesn't like it. When I load up the program it instantly crashes visual studio and the program.
I know something i'm doing is not passing an address correctly and I haven't figured out how or why.
Any help would be great and even just links to other threads would help me alot. So far in my attempts I haven't found squat and I figured there would be alot on this. I am new to C++. I used java alot and decided to switch since directx is much better than java3d
I know this is a silly question that a beginner would ask but i'm just stumped.
Once again any help would be awesome
Thanks all