Original Post
In a lot of examples when working with buffers, it follows a pretty standard approach of locking, mem copying and unlocking:
My question is, I am working on an algo that loads vertice information, and than will create a vertex buffer on a per object basis. So say at point A, i pass an object that contains a vertex buffer, create the vertex buffer with my d3d device, lock, memcpy and unlock. Then say at point C I want to pass a different object that contains a vertex buffer, and create the buffer, fill the memory and unlock. Do I need a new VOID pointer, or is it reusable so I can just declare it on the stack each time the function is called to create my buffers?
Thanks.
VOID* pVoid;
_vBuffer->Lock(0, 0, (void**)&pVoid, 0);
memcpy(pVoid, source, size);
_vBuffer->Unlock();
My question is, I am working on an algo that loads vertice information, and than will create a vertex buffer on a per object basis. So say at point A, i pass an object that contains a vertex buffer, create the vertex buffer with my d3d device, lock, memcpy and unlock. Then say at point C I want to pass a different object that contains a vertex buffer, and create the buffer, fill the memory and unlock. Do I need a new VOID pointer, or is it reusable so I can just declare it on the stack each time the function is called to create my buffers?
Thanks.