// 从X文件中加载网格数据
LPD3DXBUFFER pAdjBuffer = NULL;
LPD3DXBUFFER pMtrlBuffer = NULL;
D3DXLoadMeshFromX(L"rw.X", D3DXMESH_MANAGED, g_pd3dDevice,
&pAdjBuffer, &pMtrlBuffer, NULL, &g_dwNumMtrls, &g_pMesh);
// 读取材质和纹理数据
D3DXMATERIAL *pMtrls = (D3DXMATERIAL*)pMtrlBuffer->GetBufferPointer();
g_pMaterials = new D3DMATERIAL9[g_dwNumMtrls];
g_pTextures = new LPDIRECT3DTEXTURE9[g_dwNumMtrls];
for (DWORD i=0; i<g_dwNumMtrls; i++)
{
g_pMaterials[i] = pMtrls[i].MatD3D;
g_pMaterials[i].Ambient = g_pMaterials[i].Diffuse;
g_pTextures[i] = NULL;
D3DXCreateTextureFromFileA(g_pd3dDevice, pMtrls[i].pTextureFilename, &g_pTextures[i]);
}
pAdjBuffer->Release();
pMtrlBuffer->Release();
运行提示错误在:D3DXMATERIAL *pMtrls = (D3DXMATERIAL*)pMtrlBuffer->GetBufferPointer();
7 个解决方案
#1
设置断点查看发现是
创建失败,返回的代码是-2005531760,有人能告诉我这是什么错误啊?
怎么没人回答啊?
D3DXLoadMeshFromX(L"rw.X", D3DXMESH_MANAGED, g_pd3dDevice,
&pAdjBuffer, &pMtrlBuffer, NULL, &g_dwNumMtrls, &g_pMesh);
创建失败,返回的代码是-2005531760,有人能告诉我这是什么错误啊?
怎么没人回答啊?
#2
为什么就是没人看呢?难道我发错地方了!
#3
错误原因如下:
HRESULT: 0x88760390 (2289435536)
Name: D3DXFERR_PARSEERROR
Description: Parse error
Severity code: Failed
Facility Code: FACILITY_D3D (2166)
Error Code: 0x0390 (912)
估计.x文件有问题。
HRESULT: 0x88760390 (2289435536)
Name: D3DXFERR_PARSEERROR
Description: Parse error
Severity code: Failed
Facility Code: FACILITY_D3D (2166)
Error Code: 0x0390 (912)
估计.x文件有问题。
#4
估计是创建失败
导致pMtrlBuffe还是为NULL,然后pMtrlBuffer->GetBufferPointer()出错了;
调用前检查下是否为NULL
导致pMtrlBuffe还是为NULL,然后pMtrlBuffer->GetBufferPointer()出错了;
调用前检查下是否为NULL
#5
你点了编译执行之后不要动鼠标键盘,就会好的,你试试
#6
我也遇到了这个问题,貌似是.X文件的原因,楼主现在解决了吗?
#7
.x文件里面没有材质的原因吧。
#1
设置断点查看发现是
创建失败,返回的代码是-2005531760,有人能告诉我这是什么错误啊?
怎么没人回答啊?
D3DXLoadMeshFromX(L"rw.X", D3DXMESH_MANAGED, g_pd3dDevice,
&pAdjBuffer, &pMtrlBuffer, NULL, &g_dwNumMtrls, &g_pMesh);
创建失败,返回的代码是-2005531760,有人能告诉我这是什么错误啊?
怎么没人回答啊?
#2
为什么就是没人看呢?难道我发错地方了!
#3
错误原因如下:
HRESULT: 0x88760390 (2289435536)
Name: D3DXFERR_PARSEERROR
Description: Parse error
Severity code: Failed
Facility Code: FACILITY_D3D (2166)
Error Code: 0x0390 (912)
估计.x文件有问题。
HRESULT: 0x88760390 (2289435536)
Name: D3DXFERR_PARSEERROR
Description: Parse error
Severity code: Failed
Facility Code: FACILITY_D3D (2166)
Error Code: 0x0390 (912)
估计.x文件有问题。
#4
估计是创建失败
导致pMtrlBuffe还是为NULL,然后pMtrlBuffer->GetBufferPointer()出错了;
调用前检查下是否为NULL
导致pMtrlBuffe还是为NULL,然后pMtrlBuffer->GetBufferPointer()出错了;
调用前检查下是否为NULL
#5
你点了编译执行之后不要动鼠标键盘,就会好的,你试试
#6
我也遇到了这个问题,貌似是.X文件的原因,楼主现在解决了吗?
#7
.x文件里面没有材质的原因吧。