vertex_create_buffer_from_buffer

Create a vertex buffer from a regular buffer.

Syntax:

vertex_create_buffer_from_buffer(buffer, format);


Argument Description
buffer The buffer to create the vertex buffer from.
format The primitive vertex format to use.


Returns: Pointer


Description

As with the function vertex_create_buffer, this function will create a new vertex buffer, only now the vertex data it stores is copied from the regular buffer that is specified as the source. The buffer created is a special grow buffer which is pre-formatted with the vertex format for building primitives for use with (for example) shaders. This function requires that you supply the pointer to a previously created regular buffer, and a vertex format that should be applied to the copied data.


Example:

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

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.


Back: Vertex Formats
Next: vertex_delete_buffer
© Copyright YoYo Games Ltd. 2015 All Rights Reserved