draw_primitive_end


语法:

draw_primitive_end()


Returns:

N/A(无返回值)


描述

This function must be called when you have finished defining the points of your primitive. If you do not call this function, nothing will be drawn as this effectively tells GameMaker Studio 2 that you have finished and that it can now draw the defined primitive.


例如:

var tex;
var tex = sprite_get_texture(spr_Background);
draw_primitive_begin_texture(pr_trianglestrip, tex);
draw_vertex_texture(0, 480, 0, 0);
draw_vertex_texture(640, 480, 1, 0);
draw_vertex_texture(640, 480, 1, 1);
draw_vertex_texture(0, 480, 0, 1);
draw_primitive_end();

上述函数将会创建一个四定点的三角形带(即两个共享一条边的三角形)并为其使用“vex"变量中储存的纹理。