游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2516|回复: 3

关于mesh读取中的一个错误,大家快来帮帮忙。谢谢

[复制链接]

36

主题

382

帖子

498

积分

中级会员

Rank: 3Rank: 3

积分
498
发表于 2004-7-7 17:44:00 | 显示全部楼层 |阅读模式
自己读取.x文件中的mesh。
代码如下:
IDirectXFileData *pData;
。。。。。
if(*pType == TID_D3DRMMesh) {
     
           LPD3DXMESH Mesh;
          ID3DXBuffer *Materials;
                  DWORD NumMaterials;
////////////下面这句有错误//////////////
D3DXLoadMeshFromXof(pData,D3DXMESH_SYSTEMMEM ,  D3D_Device,
                   NULL, &Materials, NULL, &NumMaterials, &Mesh);
////////////////////////////////////////////
}

编译时可以通过,可是一运行就出错了。
只要把这一小段屏蔽,就又正常。
//////////这时系统的报错信息//////////////////
WindowClass.exe 中的 0x004d6970 处最可能的异常: 0xC0000005: 读取位置 0xcccccccc 时发生访问冲突 。
//////////////////////////////////////////////////
请大家给看看,是不是读取前后有什么忌讳之类的东西。谢拉。

2

主题

17

帖子

23

积分

注册会员

Rank: 2

积分
23
发表于 2004-7-7 21:41:00 | 显示全部楼层

Re: 关于mesh读取中的一个错误,大家快来帮帮忙。谢谢

first chance exception is NOT an error. you might have turned on some C++ settting somewhere that indicates the debugger to take over when any first chance exception happens. turn it off, and you will get a smooth go!

btw: are you sure that there is ONLY that first chance exception?

36

主题

382

帖子

498

积分

中级会员

Rank: 3Rank: 3

积分
498
 楼主| 发表于 2004-7-8 07:22:00 | 显示全部楼层

Re:关于mesh读取中的一个错误,大家快来帮帮忙。谢谢

问题倒是找到了,第5个参数不能是null,必须是一个adjusetXXX什么的。
总而言之把那个参数搞一下就可以了。

2

主题

17

帖子

23

积分

注册会员

Rank: 2

积分
23
发表于 2004-7-8 19:51:00 | 显示全部楼层

Re:关于mesh读取中的一个错误,大家快来帮帮忙。谢谢

oh, yeah. for that adjacency you need to declare something like:
LPD3DXBUFFER pd3dxAdjacencyBuffer = NULL;
and you pass it to the function as &pd3dxAdjacencyBuffer, after the function returns, you will get an adjacency buffer to work with. when done with the buffer, don't forget to release the buffer by calling pd3dxAdjacencyBuffer->Release();
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-7-3 10:55

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表