Phaser API Documentation

  Version: 
canvasToTexture(srcCanvas, [dstTexture], [noRepeat], [flipY])

Description:

Creates a new WebGL Texture based on the given Canvas Element.

If the dstTexture parameter is given, the WebGL Texture is updated, rather than created fresh.

Parameters:

name type arguments Default description
srcCanvas HTMLCanvasElement

The Canvas to create the WebGL Texture from

dstTexture WebGLTexture <optional>

The destination WebGL Texture to set.

noRepeat boolean <optional> false

Should this canvas be allowed to set REPEAT (such as for Text objects?)

flipY boolean <optional> false

Should the WebGL Texture set UNPACK_MULTIPLY_FLIP_Y?

Returns:
Description:

The newly created, or updated, WebGL Texture.

Type:
  • WebGLTexture
Examples:
Since: 3.0.0