This function can be used to copy some (or all) of the vertex data stored in one vertex buffer into a previously created regular buffer. When copying from a vertex buffer into a regular buffer with this function, both buffers must have previously been created (using the vertex_create_buffer() and buffer_create() functions, for example). You can specify the range of vertex data that you wish to copy into the buffer, where the start vertex can be anywhere between 0 and the number of vertices -1, and you can give the number of vertices from that point on to copy. You can use the function vertex_get_number() on the vertex buffer to get the total number of vertices stored. Finally you give the buffer index to copy the vertex data into, as well as a data offset to define the position to copy the vertex data to in the destination buffer.
buffer_copy_from_vertex_buffer(vertex_buffer, start_vertex, num_vertices, dest_buffer, dest_offset);
| Argument | Type | Description |
|---|---|---|
| vertex_buffer | Vertex Buffer | The index of the vertex buffer to copy from. |
| start_vertex | Real | The starting vertex. |
| num_vertices | Real | The total number of vertices to use. |
| dest_buffer | Buffer | The index of the buffer to copy to. |
| dest_offset | Real | The offset position to copy the data to (in bytes). |
N/A
var v_num = vertex_get_number(model_buff); buffer_copy_from_vertex_buffer(model_buffer, 0, v_num - 1, player_buffer, 0);
The above code will copy the vertex data stored in the vertex buffer indexed in the variable "model_buffer", and then paste it into the buffer indexed in the variable "player_buffer".