[300分]关于D3D中GenerateAdjacency函数的使用~~~~~~~~~~~~~~~~~~~~
时间:2011-11-28
来源:互联网
Syntax
Copy
HRESULT GenerateAdjacency(
[in] FLOAT Epsilon,
[in] DWORD *pAdjacency
);
Parameters
Epsilon [in]
Type: FLOAT
Specifies that vertices that differ in position by less than epsilon should be treated as coincident.
pAdjacency [in]
Type: DWORD*
Pointer to an array of three DWORDs per face to be filled with the indices of adjacent faces. The number of bytes in this array must be at least 3 * ID3DXBaseMesh::GetNumFaces * sizeof(DWORD).
Return value
Type: HRESULT
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, E_OUTOFMEMORY.
Remarks
After an application generates adjacency information for a mesh, the mesh data can be optimized for better drawing performance.
The order of the entries in the adjacency buffer is determined by the order of the vertex indices in the index buffer. The adjacent triangle 0 always corresponds to the edge between the indices of the corners 0 and 1. The adjacent triangle 1 always corresponds to the edge between the indices of the corners 1 and 2 while the adjacent triangle 2 corresponds to the edge between the indices of the corners 2 and 0.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb205737(v=vs.85).aspx
上面是这个函数的基本介绍。俺在使用时发现,当mesh的顶点数超过2万时,此时大约有15000个三角面,此函数调用失败,2w个点以下函数调用成功。失败时返回值是E_FAIL,并木有返回上面提到的D3DERR_INVALIDCALL, E_OUTOFMEMORY.
俺的问题是:
这个D3D函数使用时,是否有内存大小或者显存大小的限制或者其他方面的限制。这个函数调用失败可能的原因有哪些?
望各位不吝赐教。

作者: Demon__Hunter 发布时间: 2011-11-28
该回复于2011-11-28 11:10:08被管理员删除
- 对我有用[0]
- 丢个板砖[0]
- 引用
- 举报
- 管理
- TOP
|
#3楼 得分:0回复于:2011-11-28 11:13:15
|
作者: Demon__Hunter 发布时间: 2011-11-28

是OptimizeInplace函数。
基本说明:http://msdn.microsoft.com/en-us/library/windows/desktop/bb174072(v=vs.85).aspx
俺在使用时发现,当mesh的顶点数超过2万时,此时大约有15000个三角面,此函数调用失败,2w个点以下函数调用成功。失败时返回值是E_FAIL(0x80004005),并木有返回D3DERR_INVALIDCALL, D3DXERR_CANNOTATTRSORT,E_OUTOFMEMORY.
俺的问题是:
这个D3D函数使用时,是否有内存大小或者显存大小的限制或者其他方面的限制。这个函数调用失败可能的原因有哪些?
作者: pengzhixi 发布时间: 2011-11-28
GetError的结果是什么呢?
GetLastError=0
作者: Demon__Hunter 发布时间: 2011-11-28
作者: Demon__Hunter 发布时间: 2011-11-28
我记得0x80004000就是一个分界线了。估计是内存不够了。
2w个点不多啊,一个点假设占12Byte 240000Byte=240KB,不至于内存不够吧

作者: pengzhixi 发布时间: 2011-11-28
300分的帖子沉的这么快

作者: Demon__Hunter 发布时间: 2011-11-28
可能的问题是显存不够
作者: Demon__Hunter 发布时间: 2011-11-28
d3d不熟,www.codesampler.com找找有没有类似的例子。
作者: keiy 发布时间: 2011-11-28
作者: dizuo 发布时间: 2011-11-28
作者: dizuo 发布时间: 2011-11-28
lz是搞3D的么?敢问现在工作内容是啥?
俺搞GIS的,3D用到一些东西,主要是做三维地形啥的。
作者: zanfeng 发布时间: 2011-11-28
win debug找找原因。
可以说详细些吗?木有看懂。。。
作者: Demon__Hunter 发布时间: 2011-11-28
2W个点,不仅仅是点占内存(显存),三角面也要占显存的,而且应该比点占得多,它应该中以像素形式存的的
可能的问题是显存不够
多谢您的回帖。恩应该不是显存不够的原因,有些东西忘说了:
超过2w个点的时候,不用OptimizeInplace函数优化,可以绘制这些点构成的三角网,只是很卡。
但用OptimizeInplace优化,OptimizeInplace函数就会调用失败。
作者: Demon__Hunter 发布时间: 2011-11-28

作者: Demon__Hunter 发布时间: 2011-11-28
如果2w个点太多,先慢慢减少这个值
作者: Dai_Dai_Cat 发布时间: 2011-11-29
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28