Phaser API Documentation

  Version: 
endDraw([erase])

Description:

Use this method to finish batch drawing to this Render Texture.

Doing so will stop the WebGL Renderer from capturing draws and then blit the framebuffer to the Render Target owned by this texture.

Calling this method without first calling beginDraw will have no effect.

Batch drawing is faster than calling draw, but you must be careful to manage the flow of code and remember to call endDraw() when you're finished.

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. Doing so will cause a run-time error in the WebGL Renderer.

You can use the RenderTexture.texture.isDrawing boolean property to tell if a batch is currently open, or not.

Parameters:

name type arguments Default description
erase boolean <optional> false

Draws all objects in this batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn.

Returns:
Description:

This Render Texture instance.