2

在 javascript 中,我有以下用于 CPU 缓冲区的数组:

var nVerts = this.m_countVertices;
this.m_bindPositions = new Float32Array(nVerts * 3);
this.m_bindNormals = new Float32Array(nVerts * 3);
this.m_deformedPositions = new Float32Array(nVerts * 3);

你推荐在objective-c中使用什么,而不是Float32Array。一个 NSArray 就足够了吗?

谢谢

4

1 回答 1

1

如果你使用 Xcode where Float32is defined,你可能应该:

Float32* m_bindPositions = (Float32*)malloc( (nVerts * 3) * sizeof(Float32));

那么它应该是一块类似于您显示的代码的内存。只是不要忘记

free(m_bindPositions)

完成后释放内存。

于 2013-02-24T23:36:23.337 回答