D3DXLoadSkinMeshFromXof, Access violation reading

Started by
2 comments, last by Evil Steve 15 years, 5 months ago
Hi, I'm very new, I have problem with D3DXLoadSkinMeshFromXof function, I use SDK Dec, 2005. And i don't know what Access violation reading here. LPD3DXMESH ppMesh = NULL; ... bool ParseObject(ID3DXFileData* pDataObj, ID3DXFileData* pParentDataObj, DWORD depth, void** data, bool reference) { GUID type; pDataObj->GetType(&type); if(reference == true) return true; if(type == TID_D3DRMMesh) { if(D3DXLoadSkinMeshFromXof(pDataObj, D3DXMESH_SYSTEMMEM, md3dDevice, NULL, NULL, NULL, NULL, NULL, &ppMesh) == D3D_OK) // problem here ... } return ParseChildObject(pDataObj, depth, data, reference); } Unhandled exception at 0x005611a5 in SkinnedMeshDemo.exe: 0xC0000005: Access violation reading location 0x00000000. And I'm linking to d3dx9d.lib. Someone can help me solve the problem! Thanks
Advertisement
Quote:Original post by thanhquoc_uit
Hi,
I'm very new, I have problem with D3DXLoadSkinMeshFromXof function, I use SDK Dec, 2005. And i don't know what Access violation reading here.

LPD3DXMESH ppMesh = NULL;
...
bool ParseObject(ID3DXFileData* pDataObj, ID3DXFileData* pParentDataObj, DWORD depth, void** data, bool reference)
{
GUID type;
pDataObj->GetType(&type);
if(reference == true)
return true;

if(type == TID_D3DRMMesh)
{
if(D3DXLoadSkinMeshFromXof(pDataObj, D3DXMESH_SYSTEMMEM, md3dDevice, NULL, NULL, NULL, NULL, NULL, &ppMesh) == D3D_OK) // problem here
...
}
return ParseChildObject(pDataObj, depth, data, reference);
}

Unhandled exception at 0x005611a5 in SkinnedMeshDemo.exe: 0xC0000005: Access violation reading location 0x00000000.

And I'm linking to d3dx9d.lib.

Someone can help me solve the problem!
Thanks
Either your pDataObj or md3dDevice pointers are null.

As an aside, you should never test against D3D_OK like that - that only checks 1 of the 2 billion success codes. Use the SUCCEEDED() or FAILED() macro instead.
Quote:Original post by Evil Steve
Either your pDataObj or md3dDevice pointers are null.

Thanks Evil Steve!
pDataObj and md3dDevice pointers are still valid
I have checked all, all okay!
I wonder there is something wrong inside D3DXLoadSkinMeshFromXof function with SDK Dec, 2005?
Then I'd guess that one or more of those NULL pointers you're passing in needs to be valid. The access violation basically means "The CPU tried to read from address 0x00000000, which is invalid" which means you have a null pointer that shouldn't be.

This topic is closed to new replies.

Advertisement