[300分]关于D3D中GenerateAdjacency函数的使用~~~~~~~~~~~~~~~~~~~~
Generate a list of mesh edges, as well as a list of faces that share each edge.
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函数使用时,是否有内存大小或者显存大小的限制或者其他方面的限制。这个函数调用失败可能的原因有哪些?
望各位不吝赐教。
[解决办法]
GetError的结果是什么呢?
[解决办法]
我记得0x80004000就是一个分界线了。估计是内存不够了。
[解决办法]
2W个点,不仅仅是点占内存(显存),三角面也要占显存的,而且应该比点占得多,它应该中以像素形式存的的
可能的问题是显存不够
[解决办法]
显存不足应该不至于的。
d3d不熟,www.codesampler.com找找有没有类似的例子。
[解决办法]
lz是搞3D的么?敢问现在工作内容是啥?
[解决办法]
win debug找找原因。
[解决办法]
换马甲顶上来吧,沉的太厉害了
[解决办法]
我觉得是显存不够,在调用OptimizeInplace前后,输出剩余显存是多少
如果2w个点太多,先慢慢减少这个值
[解决办法]
[解决办法]
不懂,接分了。
4张 EVGA的GTX580(3G显存版)组4路SLI(12G)试试。