Phaser API Documentation

  Version: 
addGLTexture(key, glTexture)

Description:

Takes a WebGLTextureWrapper and creates a Phaser Texture from it, which is added to the Texture Manager using the given key.

This allows you to then use the Texture as a normal texture for texture based Game Objects like Sprites.

This is a WebGL only feature.

Prior to Phaser 3.80.0, this method took a bare WebGLTexture as the glTexture parameter. You must now wrap the WebGLTexture in a WebGLTextureWrapper instance before passing it to this method.

Parameters:

name type description
key string

The unique string-based key of the Texture.

glTexture Phaser.Renderer.WebGL.Wrappers.WebGLTextureWrapper

The source Render Texture.

Returns:
Description:

The Texture that was created, or null if the key is already in use.

Since: 3.19.0