vertex_create_buffer_from_buffer_ext

This function creates a new vertex buffer by copying the data from the buffer that is specified as the source.

The data in the source buffer must be pre-formatted according to the vertex format for building primitives for use with (for example) shaders, and you can also supply an offset within the source buffer to copy from and the number of vertices that the final buffer should have.

WARNING If the number of vertices does not match those being copied you may get corrupted vertex data.

 

Syntax:

vertex_create_buffer_from_buffer_ext(buffer, format, src_offset, vert_num);

ArgumentTypeDescription
bufferBufferThe buffer to create the vertex buffer from.
formatPrimitive Type ConstantThe primitive vertex format to use.
src_offsetRealThe offset within the source buffer to copy from.
vert_numRealThe number of vertices the vertex buffer should have.

 

Returns:

Vertex Buffer

 

Example:

vertex_format_begin();
vertex_format_add_position_3d();
vertex_format_add_colour();
vertex_format_add_texcoord();
var my_format = vertex_format_end();
v_buff = vertex_create_buffer_from_buffer(global.modelBuff, myFormat, 0, 512);

The above code will create a new vertex format then create a new vertex buffer from a previously created regular buffer, applying the custom vertex format to it with 0 offset. The function tells the new vertex buffer that it should expect 512 vertices.