This function must be called before you can define any primitives. There are 6 types of primitives you can define with the following constants:
The following image illustrates basically how these should look and also the order in which you should define the vertexes:
Please note that on some platforms (Windows, UWP, XBox) the pr_trianglefan type is not natively
supported and so GameMaker Studio 2 does a conversion when the game is compiled to make them work. This means that on those platforms the pr_trianglefan type will be much slower to use than the others. This Also note that to use this
function on HTML5, you must enable WebGL in the Game Options.
draw_primitive_begin(kind)
Argument | Description |
---|---|
kind | The kind of primitive you are going to draw. |
N/A
var _steps = 20;
var _xx = 50;
var _yy = 50;
var _radius = 30;
draw_primitive_begin(pr_trianglefan);
draw_vertex(_xx, _yy);
for(var i = 0; i <= _steps; ++i;)
{
draw_vertex(_xx + lengthdir_x(_radius, 270 * i / _steps), _yy + lengthdir_y(_radius, 270 * i / _steps));
}
draw_primitive_end();
The above code will draw three quarters of a circle made from primitives.