Phaser API Documentation

  Version: 
beginDraw()

Description:

Use this method if you need to batch draw a large number of Game Objects to this Render Texture in a single go, or on a frequent basis.

This method starts the beginning of a batched draw.

It is faster than calling draw, but you must be very careful to manage the flow of code and remember to call endDraw(). If you don't need to draw large numbers of objects it's much safer and easier to use the draw method instead.

The flow should be:

// Call once:
RenderTexture.beginDraw();

// repeat n times:
RenderTexture.batchDraw();
// or
RenderTexture.batchDrawFrame();

// Call once:
RenderTexture.endDraw();

Do not call any methods other than batchDraw, batchDrawFrame, or endDraw once you have started a batch. Also, be very careful not to destroy this Render Texture while the batch is still open, or call beginDraw again.

Returns:
Description:

This Render Texture instance.