Vertex clear: Difference between revisions

From ENIGMA
Jump to navigation Jump to search
 
Line 1: Line 1:
{{FuncTitle|vertex_clear|buffer}}
{{FuncTitle|vertex_clear|buffer}}
== Description ==
== Description ==
Clears the client-side data in the given vertex buffer and marks it dirty as well as no longer frozen. This means the backend will upload new vertex data the next time the vertex buffer is submitted for rendering. After this function is called, and before the vertex buffer is submitted, new vertex data can be supplied that will replace the old vertex data.
Clears the client-side data in the given vertex buffer and marks it dirty as well as no longer frozen. This means the backend will upload new vertex data the next time the vertex buffer is submitted for rendering. After this function is called, and before the vertex buffer is submitted, new vertex data can be supplied that will replace the old vertex data. The function is essentially the opposite of [[vertex_freeze]] and can be called any number of times on a vertex buffer.


== Parameters ==
== Parameters ==

Latest revision as of 20:23, 17 June 2018

Description

Clears the client-side data in the given vertex buffer and marks it dirty as well as no longer frozen. This means the backend will upload new vertex data the next time the vertex buffer is submitted for rendering. After this function is called, and before the vertex buffer is submitted, new vertex data can be supplied that will replace the old vertex data. The function is essentially the opposite of vertex_freeze and can be called any number of times on a vertex buffer.

Parameters

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

Return Values

void: This function does not return anything.

Example Call

// demonstrates clearing a static vertex buffer so that its vertex data can be specified again
vertex_clear(static_buffer);

// 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);