I want to quick preallocate memory and have it wrapped by NSMutableData
but with access via pointer.
So I have this:
var vertex = UnsafeMutablePointer<Float>.alloc(numberOfVertex * 3)
vertex.initialize(0)
vertexData = NSMutableData(bytesNoCopy: vertex, length: numberOfVertex * 3 * sizeof(Float))
But when I check address of vertex
pointer I see different value then vertexData.bytes
so as I understand I can't use pointer anymore to change data by index.
How to avoid this and have only one memory block?