vertex_submit

Freeze the given vertex buffer.

Syntax:

GML Code Example

vertex_submit(buffer, primitive, texture);


Argument Description
buffer The buffer to use.
primitive The primitive base type.
texture The texture to use (or -1 for no texture).


Returns: N/A


Description

You can use this function to submit the contents of a vertex buffer to the graphics pipeline for use with a shader. You supply the buffer index to use, the base primitive type to use (see the constants below) and the texture that is to be used. The base primitive type is only used for assigning the order in which the vertexes that you stored in the buffer are drawn and connected, but the actual data used for each of the vertexes will be that which you defined when creating the vertex buffer.

For a visual example of the different base primitives available, please see the function draw_primitive_begin

NOTE: this function can only be used in the Draw Event.

Constant Description
pr_pointlist A primitive consisting of a list of points.
pr_linelist A primitive made up of a individual lines in a list.
pr_linestrip A primitive made up of a consecutive strip of lines.
pr_trianglelist A primitive made up of individual triangles in a list.
pr_triangle_strip A primitive made up of a consecutive strip of triangles.


Example:

GML Code Example

shader_set(shader_prim);
 vertex_submit(buff, pr_trianglelist, sprite_get_texture(sprite_index));
 shader_reset();
 

The above code will submit the vertex buffer indexed in the variable "buff" for drawing with the shader "shader_prim", using a triangle list as the base primitive and the texture of the sprite for the instance running the code.





No Examples Submitted

Does this page need better examples? Be the first to Submit

These are page edits suggested by the community. Cast your vote to help improve the manual.

Suggested by /u/Husi012 on June 10, 2017

there is a mistake in the example code:
sprite_get_texture needs two arguments.
1.: sprite index
2.: subimage

No Questions Have Been Ask

Do you have a question about this page? Ask it Here