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

参数 描述
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).




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...


var tex = sprite_get_texture(spr_Background);
draw_primitive_begin_texture(pr_trianglestrip, tex);
draw_vertex_texture_colour(0, 480, 0, 1, c_green, 1);
draw_vertex_texture_colour(0, 0, 0, 0, c_fuchsia, 1);
draw_vertex_texture_colour(640, 480, 1, 1, c_red, 1);
draw_vertex_texture_colour(640, 0, 1, 0, c_blue, 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.