Defines a vertex for a textured primitive in 3D, giving a blend colour and alpha.


GML Code Example

draw_vertex_texture_colour(x, y, xtex, ytex, col, alpha)

Argument Description
x The x coordinate of the vertex.
y The y coordinate of the vertex.
xtex The x coordinate within the texture.
ytex The y coordinate within the texture.
col The colour to blend with the texture at this vertex (-1 or c_white for no blending).
alpha The alpha to draw this vertex with (0-1).

Returns: N/A


This function defines the position of a textured vertex for a primitive. The final look of the primitive will depend on the primitive type chosen to draw (See draw_primitive_begin for more information), the order with which you add the vertices to it, the position of the start and end points that you give for the texture sample and the colour and alpha values that you have set. To maintain the texture appearance while changing only the alpha, a value of -1 (or c_white) may be used for the colour argument. To end and draw the primitive you must call draw_primitive_end.

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(back);
 draw_primitive_begin_texture(pr_trianglestrip, tex);
 draw_vertex_texture_colour(0, 0, 0, 0, c_fuchsia, 1);
 draw_vertex_texture_colour(640, 0, 1, 0, c_blue, 1);
 draw_vertex_texture_colour(640, 480, 1, 1, c_red, 1);
 draw_vertex_texture_colour(0, 480, 0, 1, c_green, 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, and it will be blended with four different colours.

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