samb90
samb90

Reputation: 1073

Float 32 Array in Objective-C

In javascript I have the following arrays for a CPU buffer:

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);

What do you recommend to use in objective-c, instead of Float32Array. Would an NSArray be sufficient?

Thanks

Upvotes: 2

Views: 642

Answers (1)

user2088639
user2088639

Reputation:

If you're using Xcode where Float32 is defined, you should probably just:

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

Then it should be a chunk of memory analogous to the code you've shown. Just don't forget to

free(m_bindPositions)

to release the memory when you're done with it.

Upvotes: 1

Related Questions