vertex_freeze(buffer)

From ENIGMA

Jump to: navigation, search

Description

Marks the given vertex buffer as "frozen" causing it to be treated as read-only, after which you will not be able to specify new vertex data. This function can be called at any time on a vertex buffer, but it is most efficient to call it after vertex_end because vertex buffers do not actually upload their vertex data to the GPU until the first vertex_submit if their contents are "dirty" from a vertex_begin call. Subsequent calls to this function are ignored. This function will effectively make a vertex buffer render faster because its contents will also be marked as static instead of dynamic for the driver.

Parameters

Parameter Data Type Description
buffer integer Index of the vertex buffer.

Return Values

void: This function does not return anything.

Example Call

// add a triangle to a vertex buffer we want to be static
vertex_begin(static_buffer, vf_color_position);
vertex_color(static_buffer, c_red, 1);
vertex_position(static_buffer, 100, room_height - 100);
vertex_color(static_buffer, c_green, 1);
vertex_position(static_buffer, room_width / 2, 100);
vertex_color(static_buffer, c_blue, 1);
vertex_position(static_buffer, room_width - 100, 100);
vertex_end(static_buffer);

// demonstrates freezing a vertex buffer just after specifying its vertex data
vertex_freeze(static_buffer);
Personal tools
Namespaces
Variants
Actions
Navigation
ENIGMA
Other
Toolbox