draw method
Appends a non-indexed draw of vertexCount vertices.
The vertices are read from the vertex buffers previously bound with bindVertexBuffer. Buffers whose VertexBuffer.stepMode is VertexStepMode.vertex advance once per vertex. Buffers whose VertexBuffer.stepMode is VertexStepMode.instance advance once per instance.
Set instanceCount greater than 1 to repeat the same vertex range
multiple times while reading a new element from each instance-rate vertex
buffer for each instance. A vertexCount or instanceCount of 0 is
valid and records no drawing work.
If the bound pipeline does not use any instance-rate vertex buffers, each instance receives the same vertex buffer data. This is valid, but every instance will produce the same geometry unless the shader varies its output another way.
Implementation
void draw(int vertexCount, {int instanceCount = 1}) {
RangeError.checkNotNegative(vertexCount, 'vertexCount');
RangeError.checkNotNegative(instanceCount, 'instanceCount');
if (vertexCount == 0 || instanceCount == 0) {
return;
}
_validateVertexBindings();
if (!_draw(vertexCount, instanceCount)) {
throw Exception("Failed to append draw");
}
}