Phaser API Documentation

  Version: 
copyFrameRect(source, target, x, y, width, height, [clear], [clearAlpha])

Description:

Binds the source Render Target and then copies a section of it to the target Render Target.

This method is extremely fast because it uses gl.copyTexSubImage2D and doesn't require the use of any shaders. Remember the coordinates are given in standard WebGL format, where x and y specify the lower-left corner of the section, not the top-left. Also, the copy entirely replaces the contents of the target texture, no 'merging' or 'blending' takes place.

Parameters:

name type arguments Default description
source Phaser.Renderer.WebGL.RenderTarget

The source Render Target.

target Phaser.Renderer.WebGL.RenderTarget

The target Render Target.

x number

The x coordinate of the lower left corner where to start copying.

y number

The y coordinate of the lower left corner where to start copying.

width number

The width of the texture.

height number

The height of the texture.

clear boolean <optional> true

Clear the target before copying?

clearAlpha boolean <optional> true

Clear the alpha channel when running gl.clear on the target?