Begins the process of defining a textured primitive.


GML Code Example

draw_primitive_begin_texture(kind, tex)

Argument Description
kind The kind of primitive you are going to draw.
tex The texture to use with the primitive.

Returns: N/A


This function must be called before you define the vertices of a textured primitive. You must give the kind of primitive to use (see draw_primitive_begin for more information) and the id of a texture to use, which can be a sprite or background image asset. This asset id can be gotten from the functions sprite_get_texture and background_get_texture (use -1 for no texture).

NOTE: For a texture to repeat it must be a power of two in size, ie: 32x32, 128x128, etc...


GML Code Example

 var tex = background_get_texture(background0);
 draw_primitive_begin_texture(pr_trianglestrip, tex);
 draw_vertex_texture(0, 0, 0, 0);
 draw_vertex_texture(640, 0, 1, 0);
 draw_vertex_texture(640, 480, 1, 1);
 draw_vertex_texture(0, 480, 0, 1);

The above code will draw a 4 vertex triangle strip (making a rectangle) textured with the texture held in the "tex" variable, and the whole texture will be used to cover the completed primitive.

No Examples Submitted

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

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

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