Original Post
here is the code here is the error: ------ Build started: Project: Meshes tut, Configuration: Debug Win32 ------ Compiling... WinMian.cpp c:\Documents and Settings\Nicklas\Mina dokument\Visual Studio Projects\Meshes tut\WinMian.cpp(121) : error C2664: 'D3DXLoadMeshFromXA' : cannot convert parameter 1 from 'const unsigned short [8]' to 'LPCSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast c:\Documents and Settings\Nicklas\Mina dokument\Visual Studio Projects\Meshes tut\WinMian.cpp(125) : error C2227: left of '->GetBufferPointer' must point to class/struct/union type is 'LPD3DXBUFFER * ' Build log was saved at "file://c:\Documents and Settings\Nicklas\Mina dokument\Visual Studio Projects\Meshes tut\Debug\BuildLog.htm" Meshes tut - 2 error(s), 0 warning(s) ---------------------- Done ---------------------- Build: 0 succeeded, 1 failed, 0 skipped [/source]
void Mesh(void)
{
LPD3DXBUFFER* bufShipMaterial;
D3DXLoadMeshFromX(L"Thing.x",
D3DXMESH_SYSTEMMEM,
pd3dDevice,
NULL,
&bufShipMaterial,
NULL,
&numMaterials,
&THING);
// trycker ner allt i tempMaterials!
D3DXMATERIAL* tempMaterials = (D3DXMATERIAL*)bufShipMaterial->GetBufferPointer();
// skapar ett nytt material för varje grej i meshen
material = new D3DMATERIAL9[numMaterials];
for(DWORD i = 0; i < numMaterials; i++) // för varje material
{
material = tempMaterials.MatD3D; // skaffar material infot
material.Ambient = material.Diffuse; // gör ambient samma som diffues!
}
return;
}