This function copies 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 vertex buffer to copy from. |
start_vertex | Real | The starting vertex. |
num_vertices | Real | The total number of vertices to copy. |
dest_buffer | Buffer | 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 copies the vertex data stored in the vertex buffer stored in the variable model_buffer, and then pastes it into the buffer stored in the variable player_buffer.